我正在使用支持库com.android.support:design:27.0.2
,我在EditText
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColorHint="@color/primary_dark"
android:id="@+id/edit_inputPassword"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/primary_dark"
app:passwordToggleDrawable="@drawable/ic_remove_red_eye_black_24dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:elevation="15dp"
android:inputType="textPassword"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:id="@+id/edit_editPassword"/>
</android.support.design.widget.TextInputLayout>
但是当我点击Toggle按钮(Eye按钮)时,它没有显示密码String
。
答案 0 :(得分:0)
考虑使用android.support.design.widget.TextInputEditText
而不仅仅是EditText
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColorHint="@color/primary_dark"
android:id="@+id/edit_inputPassword"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/primary_dark"
app:passwordToggleDrawable="@drawable/ic_remove_red_eye_black_24dp">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:elevation="15dp"
android:inputType="textPassword"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:id="@+id/edit_editPassword"/>
</android.support.design.widget.TextInputLayout>