I am having this issue where I am using the Android\'s Holo theme on a tablet project. However, I have a fragment on screen which has a white background. I am adding an
are you want specific color you must use AppCompatEditText then backround set null
works for me
<android.support.v7.widget.AppCompatEditText
android:background="@null"
android:textCursorDrawable="@color/cursorColor"/>
See this gist
Setting the android:textCursorDrawable
attribute to @null
should result in the use of android:textColor
as the cursor color.
Attribute "textCursorDrawable" is available in API level 12 and higher
In Layout
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textCursorDrawable="@drawable/color_cursor"
/>
Then create drawalble xml: color_cursor
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<size android:width="3dp" />
<solid android:color="#FFFFFF" />
</shape>
You have a white color cursor on EditText property.
It appears as if all the answers go around the bushes.
In your EditText
, use the property:
android:textCursorDrawable="@drawable/black_cursor"
and add the drawable black_cursor.xml
to your resources, as follows:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<size android:width="1dp" />
<solid android:color="#000000"/>
</shape>
This is also the way to create more diverse cursors, if you need.
Pay attention to your colorAccent in your current Activity/fragment/Dialog, defined in Styles... ;) cursor color is related to it.
Edittext cursor color you want changes your color.
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textCursorDrawable="@drawable/color_cursor"
/>
Then create drawalble xml: color_cursor
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<size android:width="3dp" />
<solid android:color="#FFFFFF" />
</shape>