如何更改文本选择工具栏的颜色,当我们复制一个案文来? [英] How to Change the Text Selection Toolbar color which comes when we copy a text?
问题描述
我开发一个应用程序,我设置的Android:textIsSelectable为TextViews。
I am developing an application and i set "android:textIsSelectable" for the TextViews.
但我的材料的主题不与TextSelection appBar匹配。有没有办法通过它我可以改变appBar ??
But my material theme is not matching with the TextSelection appBar. Is there a way by which i can change the color of that appBar ??
连接下面的图片查看: -
Attached the Image Below Check it :-
推荐答案
假设你使用 appcompat-V7
库添加这些到你的主题:¨
Assuming you use the appcompat-v7
library add these to your theme:¨
<!-- this makes sure the action mode is painted over not above the action bar -->
<item name="windowActionModeOverlay">true</item>
<item name="actionModeBackground">@drawable/myapp_action_mode_background</item>
现在我无法风格的动作模式的内侧(文本颜色,图标的颜色),所以希望你不会需要。
Now I wasn't able to style the insides of the action mode (text color, icon colors) so hopefully you won't need to.
请注意:如果你不使用支持库prePEND的风格条目名称与机器人:
。这些工作将上述API 11 +。
Note: If you don't use the support library prepend those style item names with android:
. These will work above API 11+.
修改
对于操作模式的背景与中风创建一个新的绘制和更新的参考。提拉可能是这样的:
For an action mode background with a stroke create a new drawable and update the reference. The drawable could look like this:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="-2dp" android:left="-2dp" android:right="-2dp">
<shape android:shape="rectangle">
<solid android:color="@color/primary_dark"/>
<stroke android:color="@color/accent" android:width="2dp"/>
</shape>
</item>
</layer-list>
这篇关于如何更改文本选择工具栏的颜色,当我们复制一个案文来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!