Style showing error in android

450 Views Asked by At

The following style shows error in eclipse

 <style name="AppTheme" parent="android:style/Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary</item>
    <item name="android:windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
    <item name="colorControlNormal">@color/primary</item>
    <item name="colorControlActivated">@color/primary</item>
    <item name="colorControlHighlight">@color/primary</item>
</style>

<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
    <item name="spinBars">true</item>
    <item name="color">@color/white</item>
</style>

it shows a error like this

error: Error retrieving parent for item: No resource found that matches the given name 'android:style/Theme.AppCompat.Light.NoActionBar'.

while i searched, i get to know that it is the problem of the dependency. I tried a lot to solve it. But i still get the same error .

If i change the theme there is no error, but i need this particular style.

I tried the following theme

 <style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">     
     // Your style here

this is woking . but i need the above theme .

1

There are 1 best solutions below

4
On

If your activity extends AppCompactActivity, your parent theme should be

<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar" />

where as, if using ActionBarActivity, theme should be

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar" />

Make sure you have set up the dependencies in your project. This feature required appcompactv7.