2017-02-14 2 views
1

パスワードを入力すると逆の順序で表示される上記の目のアイコンは、パスワードが見えないときは目に見えません。あなたは2つのdrawableを取るし、ボタンをクリックするか、以下のようにEditTextdrawableを設定して下のような他のイベントにdrawable画像を動的に変更しなければなりませんパスワードアイアイコンを反転する方法は?

<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を追加し、手動でイメージビューで画像を管理する必要があると思います –

+0

このリンクを参照してくださいhttp://stackoverflow.c om/questions/3685790/hide-and-view-password間の切り替え方法 –

答えて

0

それを反転する方法

おかげで、:

Drawable img = getContext().getResources().getDrawable(R.drawable.smiley); 
editText.setCompoundDrawablesWithIntrinsicBounds(null, null, img, null); 
関連する問題