Click here to Skip to main content
15,896,496 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to change the color of ActionBar into blue. In order to acheive this i changed the styles.xml as
XML
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->.
        <item name="android:actionBarStyle">@style/MyActionBar</item>
    </style>

    <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">#0000FF</item>
    </style>


and changed the android:theme in manifest.xml to MyActionBar
on running the app i get an error :
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

where have i made the mistake. please need guidence
Posted

<resources>

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

        <item name="colorPrimary">@color/yourColorResource</item>
        <!-- Customize your theme here. -->
    </style>

</resources>


Instead of @color/yourColorResource, you can directly use a color's hexcode or Android's pre-defined resources.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900