美文网首页
Android Button设置Background无效问题解决

Android Button设置Background无效问题解决

作者: Acydmr | 来源:发表于2020-11-21 22:58 被阅读0次

<shape xmlns:android="http://schemas.android.com/apk/res/android"

    android:shape="rectangle">

    <corners android:radius="5dp"/>

    <solid android:color="#FFD301"/>

</shape>

在xml中给Button设置android:background="@drawable/shape" 发现不生效,颜色依然是蓝紫色

!!!!!!!!!!

解决:

在res/values/themes.xml 中:

parent="Theme.MaterialComponents.DayNight.DarkActionBar" 修改为

parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge" 即可!!

相关文章

网友评论

      本文标题:Android Button设置Background无效问题解决

      本文链接:https://www.haomeiwen.com/subject/npdyiktx.html