Android的:改变颜色/外观的EditText选择手柄/锚手柄、外观、颜色、Android

2023-09-12 03:32:22 作者:穿一暑假拖鞋不会系鞋带了

于是,我改变了河洛主题与全息颜色生成器和的动作栏样式生成器我自己的颜色。但是,当我选择内部的编辑文本的文本,在标记在选择的位置仍然是蓝色的。我怎样才能改变呢?

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>