【发布时间】:2016-01-08 17:56:03
【问题描述】:
我看到了一些 SO 问题,他们提供了一些可能的方法来实现我想要的。例如:
-
在styles.xml 中使用
colorControlHighlight属性。这是我的样式-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"/>而且它不起作用。我也试过把
parent="Theme.AppCompat加到“SelectableItemBackground”样式,或者改成colorControlHighlight(no android: prefix)",或者改成?android:attr/selectableItemBackground,都没有用。 -
在布局中使用
backgroundTint属性。所以我将
android:backgroundTint="#5677FC"添加到我的TextView。还是没用。然后我尝试将android:backgroundTintMode更改为src_in和src_atop,它们并没有什么不同。
那么,当我使用?attr/selectableItemBackground 作为背景时,如何更改波纹颜色。我只关注棒棒糖及以上。提前谢谢!
【问题讨论】:
标签: android android-layout android-5.0-lollipop material-design android-appcompat