Thursday, 3 December 2015

XML : Android Studio Rendering Problems - Missing styles?

I get following error in the Preview window of Android Studio:

Rendering Problems Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find '?attr/actionBarPopupTheme' in current theme. (4 similar errors not shown)

I have created a custom style/theme. This is the regarding styles.xml:

  <resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">        <style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light">          <item name="android:actionBarStyle"   tools:ignore="NewApi">@style/MyActionBar</item>          <item name="actionBarStyle">@style/MyActionBar</item>          <item name="actionBarTheme">@style/MyActionBarTheme</item>      </style>        <style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">          <item name="android:background"  tools:ignore="NewApi">@color/white</item>          <item name="titleTextStyle">@style/MyActionBar.ActionBar.TitleTextStyle</item>          <item name="background">@color/bg_common</item>      </style>        <style name="MyActionBarTheme" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">          <item name="actionMenuTextColor">@color/title</item>          <item name="colorControlNormal">@color/title</item>      </style>        <style name="MyActionBar.ActionBar.TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">          <item name="android:textColor">@color/title</item>      </style>  </resources>    

My layout file header looks like this:

  <android.support.v4.widget.DrawerLayout      xmlns:android="http://schemas.android.com/apk/res/android"      xmlns:tools="http://schemas.android.com/tools"      style="@style/CustomActionBarTheme"      android:id="@+id/drawer_layout"      android:background="@color/bg_common_2"      android:layout_width="match_parent"      android:layout_height="match_parent"      tools:context=".MainActivity">    ...    

And in my manifest file I have added in the application tag:

  android:theme="@style/CustomActionBarTheme"     

Why do I get the error? I also choosed CustomActionBarTheme in my Preview windows as Theme. Am I missing something? Thanks for any advice in advance!

No comments:

Post a Comment