3

Create project by using Login Activity template with minimum SDK API 14 from Android Studio, then customize colorAccent as pink color in styles.xml:

<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>

    <item name="colorAccent">#FF4081</item><!-- pink color -->

</style>

LG Nexus 5X able to take effect (Tested with Marshmallow and Nougat): enter image description here

But no effect in Huawei P9 Lite (Marshmallow): enter image description here

What should i do to make cursor+pointer color portable ?

Note that colorControlActivated has the same problem, not only colorAccent.

[UPDATE]

Tested with Xiaomi Mi 3 and no such problem. android:textCursorDrawable="@drawable/fb" has the same behaviour for this 3 devices (i.e. only Huawei P9 Lite not working).

林果皞
  • 7,539
  • 3
  • 55
  • 70

2 Answers2

1

You can try this:

Define a drawable resource : cursor_green.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/green"/>
<size android:width="2dp"/>
</shape>

And then set it to EditText using

android:textCursorDrawable="@drawable/cursor_green"
Embydextrous
  • 1,611
  • 1
  • 12
  • 20
  • 1. This only able to change cursor(vertical line) color, not including pointer(water shape) color. 2. Nevertheless, Huawei P9 Lite still not able to take effect even cursor color with your code, but LG Nexus 5X no problem. – 林果皞 Sep 26 '16 at 21:35
0

Try to add android:imeOptions="actionNext" to EditText. It helps me.

Стас
  • 1
  • 1
  • Thanks for the answer but I not able to reproduce it to test your answer, it seems like Huawei P9 Lite patched the bug. – 林果皞 May 13 '19 at 18:32