Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AutoCompleteTextView change the underline color

I am using an AutocompleteTextView in Android app.

How to change the Underline color and also the cursor color?

like image 562
Santhosh Avatar asked Aug 17 '16 09:08

Santhosh


1 Answers

Step 1 Define a style in styles.xml

<style name="Autocomplete">
    <item name="colorControlNormal">@color/blue</item>
    <item name="colorControlActivated">@color/black</item>
</style>

Where colorControlNormal is the color of the underline when the AutoCompleteTextView has no focus, and colorControlActivated is the color of the cursor and underline when it has focus.

Step 2 Add the style to your AutoCompleteTextView

<AutoCompleteTextView  
    android:id="@+id/autocomplete"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/Autocomplete"/>

Check this tutorial of AutoCompleteTextViews for more information.

like image 188
Drilon Blakqori Avatar answered Oct 19 '22 19:10

Drilon Blakqori