Android 8.0 Oreo crash on focusing TextInputEditText

前端 未结 8 1631
借酒劲吻你
借酒劲吻你 2020-12-12 14:28

After updating some of our devices to android 8.0 , upon focusing on a TextInputEditText field inside of a TextInputLayout, the app crashes with th

相关标签:
8条回答
  • 2020-12-12 15:27

    Luke Simpson almost make it right, just should use "styles.xml" instead of "themes.xml".

    I created a new style file with version qualifier, aiming to v26, to make it clearer.
    Just copy and paste your AppTheme for the v26/styles.xml and add editTextStyle items the EditTextStyle style.

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        ...
        <item name="android:editTextStyle">@style/App_EditTextStyle</item>
        <item name="editTextStyle">@style/App_EditTextStyle</item>
    </style>
    
    <style name="App_EditTextStyle" parent="@android:style/Widget.EditText">
        <item name="android:importantForAutofill">noExcludeDescendants</item>
    </style>
    

    In this way you make this changes for all your EditTexts without needing to change your layout files.

    0 讨论(0)
  • 2020-12-12 15:30

    I have also facing this issue and finally we got the reason of crash on android 8.0 and android 8.1.

    first reason(important clue): empty hint(android:hint="") in xml leads to crash in oreo device.Please remove this empty hint in editText in whole project search.

    second reason(same as above explain): make sure your editText hint should be show inside TextInputLayout if you have used TextInputLayout otherwise you can use hint inside editText.

    Hope this helpe you !!

    Thank you

    0 讨论(0)
提交回复
热议问题