Mario S
Mario S

Reputation: 301

Android - how to display the Action Bar using the default Theme.Light

I would like to use the default Android Theme.Light in one my activities. However, when this particular theme is applied in my application Manifest file for the selected activity:

android:theme="@android:style/Theme.Light">

it hides the activity Action Bar.

What needs to be done in java or xml code to preserve the Action Bar, using this particular Light scheme ?

As an alternative, I have used the following default scheme:

android:theme="@android:style/Theme.DeviceDefault.Light">

That scheme does show the activity Action Bar correctly, however some of its objects are not displayed as preferred. In particular, my preference would be to display buttons and spinners as per Theme.Light, but preserve the other style formatting offered by the Theme.DeviceDefault.Light

I would greatly appreciate some tips on how to achieve the above scheme formatting preferences. (I am using SDK = 16).

Upvotes: 2

Views: 11792

Answers (3)

Lajnior
Lajnior

Reputation: 11

I have the same problem, I like Theme.light's controls, I resolved it like this:

1) define "Theme.Light.ActionBar" in project's styles :

 <style name="Theme.Light.ActionBar" parent="@android:style/Theme.Light">
    <item name="android:windowNoTitle">false</item>
    <item name="android:windowActionBar">true</item>
</style>

2) in the manifest use it :

<activity
            android:name="com.your.Activity"
           android:theme="@style/Theme.Light.ActionBar" >

I hope that may help

Upvotes: 1

PaNaVTEC
PaNaVTEC

Reputation: 2503

Why not use "android:style/Theme.Holo.Light" ? is the same but has actionbar it was added in the newer apis

Upvotes: 4

Anderson
Anderson

Reputation: 1011

I think you should use Holo.Ligt theme. The old android Theme.Light is not even aware of action bar.

Upvotes: 1

Related Questions