我有一个问题Palette -> Text
当我想设置一些视图时,我收到一条消息问题有"Missing autofillHints attribute"
什么建议吗?
Pha*_*inh 65
autofillHintsminSdk> = 26.
应该使用android:importantForAutofill=no,如果你不想自动填充提示
<EditText
android:importantForAutofill="no"/>
Run Code Online (Sandbox Code Playgroud)
minSdk <26
1)使用 tools:ignore="Autofill"
<EditText
tools:ignore="Autofill"/>
Run Code Online (Sandbox Code Playgroud)
2)或者添加android:importantForAutofill然后tools:targetApi使IDE不对API级别发出此警告
<EditText
android:importantForAutofill="no"
tools:targetApi="o"
/>
Run Code Online (Sandbox Code Playgroud)
autofillHintsminSdk> = 26
只需要添加android:autofillHints="{a contant value}"(例如:"android:autofillHints="password")(从这里使用常量)
minSdk <26,添加tools:targetApi使IDE不发出此警告
<EditText
android:autofillHints="email"
tools:targetApi="o"/>
Run Code Online (Sandbox Code Playgroud)
注意
autofillHints并且importantForAutofill仅在API 26及更高版本中使用但我们仍然可以在API <26中使用它而不会崩溃(您可以在此答案中看到)(它不会崩溃但是当然它对API <26没有任何影响)
tool:... 只是用来让IDE不警告,它在应用程序运行时不会有任何影响
ʍѳђ*_*ઽ૯ท 47
也许你正在使用EditText.autofillHints在API 26及更高版本中用于填充空EditTexts,它实际上建议应该在那里放置哪种类型的内容.
只需添加:
android:autofillHints="username" // the type of content you want
Run Code Online (Sandbox Code Playgroud)
对你EditText和警告将消失.
您可以使用new
android:autofillHints属性来指示autofill您期望的内容类型,并android:importantForAutofill告知autofill您希望(或不希望)填充哪些视图.
阅读: https ://medium.com/@bherbst/getting-androids-autofill-to-work-for-you-21435debea1
这个: https ://developer.android.com/guide/topics/text/autofill-services
编辑:
但是你可以设置:
android:importantForAutofill="no"
Run Code Online (Sandbox Code Playgroud)
要告诉它的组件填写和摆脱错误并不重要.
| 归档时间: |
|
| 查看次数: |
42840 次 |
| 最近记录: |