Sma*_*mer 6 android android-jetpack-compose
我将登录流程从 XML 重构为 Compose。
旧的登录流程在成功登录后,Google 会建议保存您的密码。
然而,自从我重构它之后,它就不再这样做了。
旧的 XML 布局仅使用TextInputLayout和TextInputEditText。新的可组合项只是OutlinedTextField带有一些键盘选项。
<com.google.android.material.textfield.TextInputLayout
style="@style/TextInputLayoutStyle"
android:theme="@style/TextInputLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true"
android:hint="@string/password">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
OutlinedTextField(
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Password,
imeAction = ImeAction.Done
)
)
Run Code Online (Sandbox Code Playgroud)
为什么 Google 不建议保存密码?新旧代码都在同一模拟器上运行,该模拟器启用了自动填充服务。
| 归档时间: |
|
| 查看次数: |
1576 次 |
| 最近记录: |