How to change color / appearance of EditText select handle / anchor?(如何更改 EditText 选择句柄/锚点的颜色/外观?)
问题描述
所以我用 Holo Colors Generator 和 Action Bar Style Generator 到我自己的颜色.但是当我在编辑文本中选择文本时,所选位置的标记"仍然是蓝色的.怎么改?
So I changed the style of the Holo Theme with the Holo Colors Generator and Action Bar Style Generator to my own color. But when I select text inside an edit text, the "markers" at the selected positions are still blue. How can I change it?
推荐答案
这里最糟糕的部分是找到该项目的名称"以及如何在主题中调用它.所以我查看了android SDK文件夹中的每个drawable,最后找到了名为text_select_handle_middle"、text_select_handle_left"和text_select_handle_right"的drawable.
The worst part here was to find the "name" for this item and how it is called inside the theme. So I looked through every drawable in the android SDK folder and finally found the drawables named "text_select_handle_middle", "text_select_handle_left" and "text_select_handle_right".
因此解决方案很简单:将这些具有自定义设计/颜色的可绘制对象添加到您的可绘制文件夹中,并将它们添加到您的主题样式定义中,例如:
So the solution is simple: Add these drawables with customized design/color to your drawable folder and add them to your theme style definition like:
<style name="MyCustomTheme" parent="@style/MyNotSoCustomTheme">
<item name="android:textSelectHandle">@drawable/text_select_handle_middle</item>
<item name="android:textSelectHandleLeft">@drawable/text_select_handle_left</item>
<item name="android:textSelectHandleRight">@drawable/text_select_handle_right</item>
</style>
这篇关于如何更改 EditText 选择句柄/锚点的颜色/外观?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何更改 EditText 选择句柄/锚点的颜色/外观?
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01