编辑文本中的密码可见性切换无法正常工作
Password visiblity Toggle in edittext is not working properly
当密码可见时,眼睛图标上的十字不是appear.How当密码在眼睛图标上可见时放置十字符号。
<android.support.design.widget.TextInputLayout
app:passwordToggleTint="@color/white"
app:passwordToggleEnabled="true"
android:textColorHint="#818893"
android:layout_weight="0.4"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
app:hintTextAppearance="@style/TextAppearance.AppCompat">
<EditText
android:padding="10dp"
android:imeOptions="actionGo"
android:maxLines="1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:id="@+id/password"
android:hint="Password"
android:inputType="textWebPassword" />
</android.support.design.widget.TextInputLayout>
试试这个代码
<android.support.design.widget.TextInputLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/login_linear_pwd_container_margin_top"
android:background="@drawable/login_edittext_gradient"
android:gravity="center"
app:hintEnabled="false"
app:passwordToggleDrawable="@drawable/password_visibility"
app:passwordToggleEnabled="true">
<android.support.design.widget.TextInputEditText
android:id="@+id/txtPassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:hint="@string/login_password_title"
android:imeOptions="flagNoExtractUi"
android:inputType="textPassword"
android:paddingBottom="10dp"
android:paddingLeft="@dimen/login_edittext_left_padding"
android:paddingRight="@dimen/login_edittext_left_padding"
android:paddingTop="10dp"
android:textColor="@color/txt_black"
android:textColorHint="@color/tab_text_color" />
</android.support.design.widget.TextInputLayout>
将您的支持库更新到 25.1.0 24.x
中的密码切换可见性存在一些已知问题
参考这些问题:
当密码可见时,眼睛图标上的十字不是appear.How当密码在眼睛图标上可见时放置十字符号。
<android.support.design.widget.TextInputLayout
app:passwordToggleTint="@color/white"
app:passwordToggleEnabled="true"
android:textColorHint="#818893"
android:layout_weight="0.4"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
app:hintTextAppearance="@style/TextAppearance.AppCompat">
<EditText
android:padding="10dp"
android:imeOptions="actionGo"
android:maxLines="1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:id="@+id/password"
android:hint="Password"
android:inputType="textWebPassword" />
</android.support.design.widget.TextInputLayout>
试试这个代码
<android.support.design.widget.TextInputLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/login_linear_pwd_container_margin_top"
android:background="@drawable/login_edittext_gradient"
android:gravity="center"
app:hintEnabled="false"
app:passwordToggleDrawable="@drawable/password_visibility"
app:passwordToggleEnabled="true">
<android.support.design.widget.TextInputEditText
android:id="@+id/txtPassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:hint="@string/login_password_title"
android:imeOptions="flagNoExtractUi"
android:inputType="textPassword"
android:paddingBottom="10dp"
android:paddingLeft="@dimen/login_edittext_left_padding"
android:paddingRight="@dimen/login_edittext_left_padding"
android:paddingTop="10dp"
android:textColor="@color/txt_black"
android:textColorHint="@color/tab_text_color" />
</android.support.design.widget.TextInputLayout>
将您的支持库更新到 25.1.0 24.x
中的密码切换可见性存在一些已知问题参考这些问题: