我看到了一些问题,他们给出了一些可能的方法来实现我想要的.例如:
-
在样式中使用
colorControlHighlight
属性.xml.这是我的风格——v21.xml:
<style name="SelectableItemBackground"> <item name="android:colorControlHighlight">#5677FC</item> <item name="android:background">?attr/selectableItemBackground</item> </style>
和我的小工具:
<TextView android:id="@+id/tv_take_photo_as_bt" android:layout_width="280dp" android:layout_height="48dp" android:text="@string/act_take_photo" style="@style/SelectableItemBackground"/>
但它不起作用.我还try 将
parent="Theme.AppCompat
添加到"SelectableItemBackground"样式中,或者更改为colorControlHighlight(no android: prefix)"
,或者更改为?android:attr/selectableItemBackground
,这两种样式都没有用. -
在布局中使用
backgroundTint
属性.所以我在
TextView
的基础上加了android:backgroundTint="#5677FC"
.还是没用.然后我试着把android:backgroundTintMode
改成src_in
和src_atop
,结果都没什么不同.
那么,当我使用?attr/selectableItemBackground
作为背景时,我如何才能改变波纹 colored颜色 呢?我只关注棒棒糖及以上.提前谢谢您!