【问题标题】: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>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-02-16
        • 1970-01-01
        • 2017-12-28
        相关资源
        最近更新 更多