Friday, September 27, 2019

How to change EditText cursor color in Android

Currently there is an application that uses Editext in android extensively, because its features will help you to fulfill the requirements of the user, when you use editText in android you must use the EditText cursor color in event. Android in the simplest way.
I will perform a Change Edit Text cursor color in Android event like this:
Create a file xml in layout.xml
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/rl"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="10dp"
    android:orientation="vertical"
    tools:context=".MainActivity"
    android:background="@color/grey"
    >
    <EditText
        android:id="@+id/et_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="input you name"
        android:padding="20dp"
        android:textColor="@color/black"
        android:textCursorDrawable="@null"
        />
    <EditText
        android:id="@+id/et_age"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Input your age"
        android:padding="20dp"
        android:textCursorDrawable="@color/red"
        android:textColor="@color/black"
        />
</LinearLayout>
Here is the result of change edittext cursor color android :
How to change EditText cursor color in Android

No comments:

Post a Comment