Change to custom icon from eye-icon(default) for hide-show password in android EditText

后端 未结 9 997
时光取名叫无心
时光取名叫无心 2020-12-25 15:14

I want to change/display different icons for show password in android edittext. I am using following code to display icon.



        
9条回答
  •  别那么骄傲
    2020-12-25 15:27

    If you would like to use default eye icon (show/hide password) but change the icon color then you simply put the line

    app:passwordToggleTint="@color/yourColor"
    

    If you would like to use custom eye icon, you should use

    app:passwordToggleDrawable 
    

    to change the icon. and use

    app:passwordToggleTint 
    

    to change the color of the icon. your custom icon color does not show. Tint color will be shown. The whole xml code like below:

    
    
            
        
    

    and show_password_selector.xml is given below:

    
    
    
    

    Hope that will help all.

提交回复
热议问题