How to change EditText pointer color (not cursor)

橙三吉。 提交于 2019-12-03 10:29:04

in your styles.xml put like this:

<item name="colorAccent">@color/blue</item>

I recognize this is really late, but if all you want to do is change the color of the handle, you just need to add the following to your styles.xml file.

<style name="ColoredHandleTheme">
    <item name="colorControlActivated">@color/colorYouWant</item>
</style>

Or if you want to set it app-wide, you can do the following:

<style name="ColoredHandleThemeForWholeApp">
    <item name="colorAccent">@color/colorYouWant</item>
</style>

And then just set the theme on whatever activity is holding the EditText which you want to affect.

Problem solved!

CoolMind

After some hours of checking other solutions I found this one. If you wish to change a cursor handler only in one activity, you should do so. Change your values/styles.xml, for instance:

<style name="AppTheme.Cursor" parent="AppTheme">
    <item name="colorAccent">@color/cursor</item>
</style>

where @color/cursor is added in values/color.xml. After that apply the style to the activity as written here: Apply a theme to an activity in Android?.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTheme(R.style.AppTheme_Cursor);
    ...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!