Setting EditText underline color in Android

For API 21 (Lollipop) and above, just set the color of property backgroundTint on the EditText


For Pre Lollipop, API 21 and below.

The quick and easy way.



The more complex way but with more control and customization if needed.


text_box_underline.xml



    
        
            
        
    

text_box_underline_activated.xml



    
        
            
        
    

text_box_underline_selector.xml



    
    

Assign the selector to the background of the EditText.


References:
http://stackoverflow.com/questions/14542557/android-different-edittext-backgrounds-for-different-states-using-shapes-select
http://stackoverflow.com/questions/26574328/changing-edittext-bottom-line-color-with-appcompat-v7
http://stackoverflow.com/questions/24677414/how-to-change-line-color-in-edittext

Search within Codexpedia

Custom Search

Search the entire web

Custom Search