Skip to content Skip to sidebar Skip to footer

CoordinatorLayout - Failed To Resolve Attribute At Index 1 At Android.content.res.TypedArray.getDrawable

i have an error when i run the application,please help me. here is app_bar_main.xml :

Solution 1:

I got the same problem with you. And i try add this:

  <style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
  </style> 

to my activity's theme. it warns me that it require API 21 and above.

When i turn to AndroidStudio XML design view ,it show me a Rendering Problem:Missing style ... ?attr/colorPrimaryDark ...

So i change the style like this:

  <style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
   </style>

try add this. and it works for me.Hope that helps


Solution 2:

I found the solution and it's to create the following theme in your styles-v21.xml (it should already be there if you imported the sample files, but if it is not there, please create it):

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
</style> 

And calling it in the manifest, in the main activity part, as follows (delete the line I highlighted earlier and put this in its place):

android:theme="@style/AppTheme.NoActionBar">

thios should solve the probleme.

InflateException Error inflating class android.support.design.widget.CoordinatorLayout


Post a Comment for "CoordinatorLayout - Failed To Resolve Attribute At Index 1 At Android.content.res.TypedArray.getDrawable"