Android EditText Cursor Colour appears to be white


If you have created a custom Android EditText class and you see that the color of the Cursor appears to be white you can change it using textCursorDrawable attribute.

You need to set android:textCursorDrawable value as @null, this will set the cursor color as that of the Text.

Do note that android:textCursorDrawable requires minimum SDKI level to be 12 or above.

Example
    <EditText

        android:id="@+id/view"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="top|left"
        android:lineSpacingExtra="7dp"
        android:textCursorDrawable="@null"
        android:textSize="20sp"

        android:textColor="#010101"
        android:text="Hello"
        android:background="@drawable/border"
        android:scrollbars="vertical">

    </EditText>
Change EditText Cursor Color
Change EditText Cursor Color


















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap