【发布时间】:2020-05-03 10:11:31
【问题描述】:
我曾尝试使用该功能在 android studio 3.6.3 中切换密码可见性,但由于一些新的升级功能,我无法切换密码可见性。 所以我需要帮助来获得这个切换选项。
【问题讨论】:
-
due to some new upgrades features I'm not able to <x>就像以前工作过 ?最新成功使用的版本是什么?
我曾尝试使用该功能在 android studio 3.6.3 中切换密码可见性,但由于一些新的升级功能,我无法切换密码可见性。 所以我需要帮助来获得这个切换选项。
【问题讨论】:
due to some new upgrades features I'm not able to <x> 就像 我不确定您要问的是如何在 TextInputLayout 上切换密码可见性,但这对我有用。
使用 TextInputLayout 和 TextInputLayout 你可以这样做
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/lightGrey"
android:freezesText="true"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
重要的属性是TextInputLayout中的app:passwordToggleEnabled="true"。
我希望这会有所帮助。
【讨论】: