1234abcd
1234abcd

Reputation: 467

android Edittext change color background of text when input

i have edit text like this :

<EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="input something"
            android:layout_weight="1"
            android:textSize="20sp"
            android:textColor="#04ff00"
            android:textColorHint="#0094fd"/>

this is result:

enter image description here

like image, I want to change background of text when input in edittext.
how to do it?

Upvotes: 2

Views: 605

Answers (1)

Iulian Popescu
Iulian Popescu

Reputation: 2643

To achieve that behaviour add textColorHighlight to your EditText:

<EditText
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:hint="input something"
      android:layout_weight="1"
      android:textSize="20sp"
      android:textColor="#04ff00"
      android:textColorHint="#0094fd"
      android:textColorHighlight="@android:color/holo_red_light"/>

The final result is something like this: enter image description here

Upvotes: 1

Related Questions