Reputation: 87
I need some help with changing the actionbar theme. Currently its holo dark, but i want it to be holo light. I have set
<style name="ActionBar" parent="android:Theme.Holo.Light">
<item name="android:actionBarStyle">
@android:style/Widget.Holo.ActionBar
</item>
</style>
in /styles. But then i need to set it somewhere in the android manifest file, but i dont know where. Cause the action bar is a part of a bigger activity, and the activity has a holo light theme, just not the action bar. Anyone?
Upvotes: 0
Views: 6838
Reputation: 11518
What is important to know about setting themes is that by default when you create a project there are 3 folders created under Values: values
, values-v11
, and values-v14
.
The first thing one does by default, is to open the styles.xml
under the values
folder. That is where we go wrong. See, because there are 3 folders for the value files, the Android System will attempt to load the styles defined on the folder that is appropriate for the current system setup. That is, if you run the application on a Nexus Running API level 17, the styles loaded will come from values-v14
and NOT from values
.
Therefore, you must edit each styles.xml
file under each folder, to ensure that the theme is loaded correctly regardless of the API level.
Your styles.xml
for values-v14
should look like this:
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
I hope that helped.
Upvotes: 15
Reputation: 2054
Inside your manifest file, add the attribute android:theme="@style/ActionBar"
inside your <activity>
tag, if you want the theme to be applied to than one activity only.
<activity
android:name="YourActivityName"
android:theme="@style/ActionBar"
/>
If you want the theme to be applied to all the activities in the app, add the attribute inside your <application>
tag
<application
android:label="YourAppLabel"
android:theme="@style/ActionBar"
/>
Upvotes: 1