当前位置: 首页 > 知识库问答 >
问题:

Android 8.0奥利奥对焦TextInputEditText崩溃

沃楷
2023-03-14
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void
android.view.View.getBoundsOnScreen(android.graphics.Rect)' on a null object reference
at android.app.assist.AssistStructure$WindowNode.(AssistStructure.java)
at android.app.assist.AssistStructure.(AssistStructure.java)
at android.app.ActivityThread.handleRequestAssistContextExtras(ActivityThread.java:3035)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1807)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

当我们转到android设置->系统->语言&输入->高级->自动填充服务->无时,然后关注textinputedittext/textinputlayout不再崩溃。

我们如何在不禁用设备上新的8.0自动填充服务的情况下防止崩溃发生?

共有1个答案

漆雕兴平
2023-03-14

我也碰到这个了。原来问题是由于在嵌套在TextInputLayout中的EditText上设置提示文本引起的。

我做了一些挖掘,在26.0.0 beta2发行说明中发现了这个金块。Android支持发布说明2017年6月

TextInputLayout必须在onProvideAutofillStructure()上设置提示

<android.support.design.widget.TextInputLayout
    android:id="@+id/textInputLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Some Hint Text"
    android.support.design:hintAnimationEnabled="true"
    android.support.design:hintEnabled="true"
    android.support.design:layout_marginTop="16dp">

    <android.support.design.widget.TextInputEditText
        android:id="@+id/editText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

</android.support.design.widget.TextInputLayout>
 类似资料:
  • 问题内容: 在大多数Android设备中,RecognitionService将由Google的本机“ Now / Assistant”应用程序提供。 在Android Oreo之前,我可以使用以下简单代码查询Google Recognizer支持的语言: 但是,由于8.0+ ,响应中不再包含多余的内容。 在尝试将此错误记录为错误之前,我想首先查看其他程序是否可以复制-而且还要检查是否以某种方式忽

  • 对于新的Android应用程序更新,我必须将设置为26。 当我这样做时,我会在以下函数()中遇到自动售货许可库的问题: 我知道这些功能已经过时了,但是Android自动售货授权库没有更新版本,我也找不到如何让它适用于奥利奥,或者通常适用于高于Android19的版本,这是我现在使用的。 谁能帮上忙? ps.不工作。应用程序会直接崩溃。

  • [https://developer.android.com/about/versions/oreo/background.html]-真的没有办法为我的用例(但最好是为所有用例)提供永久的后台服务吗?

  • 我在和前台服务作斗争。在我的设备(Redmi 5 Plus,Android 8.1.0)上,当应用程序从最近的应用程序中删除时,服务通知将不再可见。在其他设备(Android5.0.1、Android7.0)和模拟器(Android8.1-API27)上,当应用程序从最近的应用程序中删除时,通知仍然可见。 在main activity中,我使用启动服务。 这是我的舱单文件: 我错过了什么?它是与后

  • 我已经试过了 > 在应用程序中创建自定义通知通道。 在Oreo设备上使用启动服务。