【问题标题】:Change bottom line color from Blue to something when in Action Mode在动作模式下将底线颜色从蓝色更改为某种颜色
【发布时间】:2017-02-18 07:06:43
【问题描述】:
我想知道当用户长按列表项并激活动作模式时,我们可以改变底线颜色吗?在屏幕截图中,您可以看到动作模式下的底线颜色为蓝色。我想将其更改为橙色,以使其与我的布局颜色相匹配。我试过这个:
<item name="android:actionmodebackground">@color/orange</item>
但它会将整个背景更改为橙色,但我只想更改底线颜色。可能吗?任何链接或代码 sn-p 将不胜感激。
【问题讨论】:
标签:
android
contextual-action-bar
android-actionmode
【解决方案1】:
试试这个功能:
public static void tintView(View view, int color) {
final Drawable d = view.getBackground();
final Drawable nd = d.getConstantState().newDrawable();
nd.setColorFilter(AppCompatDrawableManager.getPorterDuffColorFilter(
color, PorterDuff.Mode.SRC_IN));
view.setBackground(nd);
}
【解决方案2】:
这对我有用:
<item name="android:actionModeBackground">@android:color/white</item>
【解决方案3】:
你试过了吗?
<item name="android:backgroundSplit">@color/orange</item>