如何更改EditText的颜色/外观选择句柄/锚点? [英] How to change color / appearance of EditText select handle / anchor?

查看:131
本文介绍了如何更改EditText的颜色/外观选择句柄/锚点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我通过 Holo颜色生成器

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文件夹中的每个可绘制对象,最后找到了名为"text_select_handle_middle","text_select_handle_left"和"text_select_handle_right"的可绘制对象.

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的颜色/外观选择句柄/锚点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆