自动填充在Android应用程序中找不到视图ID

问题描述

我们有一个应用程序,我们要求在片段中输入登录名和密码。 它曾经像自动填充的魅力一样工作。密码管理器与它配合得很好,自动填充用户已经输入的密码。

但最近,当密码管理器选择用户/密码提议时,没有填写任何字段。

我们没有找到android studio SDK的哪个变化触发了这个问题(我们使用的是Android Studio 4.1.3 / Build #AI-201.8743.12.41.7199119,build on march 11,2021 / Runtime version: 1.8.0_242- release-1644-b3-6222593 amd64 )

在日志中,我们有以下提示

AutofillManager: autofill(): no View with id xxxxxxxxxxxxx

2 次(显然 1 次用于登录名,1 次用于密码)。

我们一直不知道如何调查这个问题。

表格的布局如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/loginConfigScreen"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">


    <TextView
            android:id="@+id/loginScreen__instructions_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/connect_label"/>


    <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_marginTop="50dp"
            android:layout_height="wrap_content">

        <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/usernameEdit"
                android:layout_width="match_parent"
                android:imeOptions="actionNext"
                android:singleLine="true"
                android:layout_height="wrap_content"
                android:hint="@string/user_hint"
                android:autofillHints="username"
                android:importantForAutofill="yes" />
    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/input_layout_password"
            android:layout_width="match_parent"
            android:layout_marginTop="20dp"
            app:passwordToggleEnabled="true"
            android:layout_height="wrap_content">

        <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/passwordEdit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:hint="@string/password_hint"
                android:autofillHints="password"
                android:importantForAutofill="yes" />
    </com.google.android.material.textfield.TextInputLayout>
</LinearLayout>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)