Error getting parent element: A resource was not found that matches the specified name "@android: style / Theme.AppCompat.Light.DarkActionBar"

I am following developer.android.com Android development tutorials and am currently trying to create a stylish action bar using the information provided here: https://developer.android.com/training/basics/actionbar/styling.html# CustomBackground7

Here's the res / values ​​/themes.xml code:

<?xml version="1.0" encoding="utf-8"?> <resources> <!-- the theme applied to the application or activity --> <style name="CustomActionBarTheme" parent="@android:style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:actionBarStyle">@style/MyActionBar</item> <!-- Support library compatibility --> <item name="actionBarStyle">@style/MyActionBar</item> </style> <!-- ActionBar styles --> <style name="MyActionBar" parent="@android:style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> <item name="android:background">@drawable/actionbar_background</item> <!-- Support library compatibility --> <item name="background">@drawable/actionbar_background</item> </style> </resources> 

I see icons with a red cross next to the opening style tags that hang on which the error message appears: error: error getting the parent element for the element: the resource was not found that matches the specified name "@android: style / Theme.AppCompat. Light.DarkActionBar "

  • My application has minSdkVersion = "11" and targetSdkVersion = "21", I tried to change minSdkVersion to 13, 14, but that didn't matter
  • Someone suggested checking if appcompat was marked as a library project or not, I checked it, and the isLibrary option was checked in the appcompat properties window.
  • I also made sure that appcompat was added to my project as a library project.
  • removing @android from @android: style or deleting @ does not work. However, in the first style tag, when I delete "@android", the red cross disappears, but this does not happen for the second style tag.

Please, help. I was with him in the morning, and I will not go anywhere.

+5
source share
1 answer

Try removing android: for example:

 <style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> 
+10
source

Source: https://habr.com/ru/post/1204967/


All Articles