2017-02-14 74 views
1

enter image description here如何反转密码眼睛图标?

上面的眼睛图标在编辑文本中以相反的顺序显示时输入密码,当密码不可见时密码眼睛图标是盲目的。 如何反其道而行

感谢,

<android.support.design.widget.TextInputLayout 
       android:id="@+id/layout_password" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       app:passwordToggleEnabled="true" 
       app:passwordToggleTint="#000000"> 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/password" 
        android:hint="@string/password" 
        android:inputType="textPassword"/> 
      </android.support.design.widget.TextInputLayout> 
+0

我认为你将不得不添加一个textview和imageview,并在imageview中手动管理图像 –

+0

请参阅此链接http://stackoverflow.c OM /问题/ 3685790 /如何到交换机之间隐藏并观看密码 –

回答

0

必须采取两种drawable中,然后更改drawable图像动态按钮点击或类似下面你可以设置drawableEditText像下面的任何其它事件:

Drawable img = getContext().getResources().getDrawable(R.drawable.smiley); 
editText.setCompoundDrawablesWithIntrinsicBounds(null, null, img, null);