我有这个问题,不知道它从哪里来,我已经创建了这些带有自定义背景的按钮,但是背景颜色使用了主要颜色,除非更改主要颜色,否则无法更改。
<Button
android:id="@+id/btn_teacher"
style="@style/normalText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/_16sdp"
android:background="@drawable/btn_rounded_stroke"
android:text="@string/txt_teacher" />
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="bg_color">#FFD7A4</color>
</resources>
我有很多不同颜色的按钮,所以我不能更改主要颜色
这是我的可绘制背景
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item >
<shape android:shape="rectangle" >
<size android:height="@dimen/_48sdp" />
<corners android:radius="@dimen/_24sdp" />
<stroke android:width="@dimen/_1sdp" android:color="#59CECE" />
<solid android:color="@android:color/white"/>
</shape>
</item>
</layer-list>
我正在使用谷歌的全新材料设计
implementation "com.google.android.material:material:1.3.0-alpha02"
我该如何覆盖这个颜色?
![这是按钮的图片](https://istack.dev59.com/fA1p7.webp)
@drwable/btn_round_stroke
的 xml。 - chand mohd