我为Android O支持准备我的应用程序,并希望自动填充正常工作.我在系统设置中选择了Google自动填充服务,添加了自动填充的特殊提示.
我已登录dialog延伸DialogFragment.正如在Android开发人员中所写,我不需要任何动作来进行自动填充工作,除了布局" android:autofillHints"和" android:importantForAutofill" 之外,它将自动工作.
但自动填充功能不起作用.
对话框布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/layout_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:importantForAutofill="yes"
android:orientation="vertical"
android:paddingBottom="15dp"
android:paddingLeft="21dp"
android:paddingRight="21dp"
android:paddingTop="20dp">
<TextView
style="@style/LoginDialogTextTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/button.text.enter" />
<com.myapp.android.views.widgets.TextInputLayout
android:id="@+id/layout_text_email"
android:layout_width="match_parent"
android:layout_height="59dp"
android:layout_marginTop="14dp"
android:hint="@string/label.email"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/text_email"
style="@style/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="emailAddress"
android:inputType="textEmailAddress"
app:backgroundTint="@color/_gray_text"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout" />
</com.myapp.android.views.widgets.TextInputLayout>
<RelativeLayout
style="@style/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.myapp.android.views.widgets.TextInputLayout
android:id="@+id/layout_text_password"
android:layout_width="match_parent"
android:layout_height="59dp"
android:hint="@string/hint.password"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout"
app:passwordToggleEnabled="false">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/text_password"
style="@style/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:autofillHints="password"
android:inputType="textPassword"
android:paddingRight="100dp" …Run Code Online (Sandbox Code Playgroud) 在AOSP(DisplayManagerService类)中有一个公共方法connectWifiDisplay(String deviceAdress ),但在Android SDK中没有.
如何调用此方法?