(Activity+preferencefragment) Error inflating class com.android.internal.widget.ActionBarContainer

前端 未结 2 1266
轮回少年
轮回少年 2021-01-14 23:15

I have no idea about this error. I got these mesaage from google developer console. Some devices like z3, htc m8 ,m9 can\'t execute my app. Could someone give me some hint a

相关标签:
2条回答
  • 2021-01-14 23:51

    I had the same error, and here is how I dealt with it. In the styles.xml file, in the first "AppTheme" style put Base infront of Theme.AppCompat. So it would be "Base.Theme.AppCompat.Light.DarkActionBar".

    After this, go to your "AndroidManifest" and in your activity do not use "AppBarOverlay". So it would be just "android:theme="@style/AppTheme".

    Furthermore, in "AndroidManifest" remove "package name" from your activity name, and just use ".SettingsActivity".

    If you have other activities then instead of defining AppTheme in each activity, just use android:parentActivityName=".SettingsActivity."

    I know you want to have an action bar and removing AppBarOverlay could help. Let me know if it works.

    0 讨论(0)
  • 2021-01-15 00:02

    extend class with AppCompatActivity instead of Activity it will give you the action bar

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