noelicus
noelicus

Reputation: 15055

Android theme set to black, but it is white in Android 4.1

I have tried both Theme.DeviceDefault and Theme.Black in my styles.xml, and both make my 2.1 emulator become black correctly, but on the 4.1 emulator it stays white...am I doing something wrong?

<resources>

    <style name="AppTheme" parent="android:Theme.Black" />

</resources>

PS: I presume the drop-down for "Theme" at the top of the Graphical Layout is just showing me what it would look like, it's not some kind of setting that's going somewhere (for the app)?

Upvotes: 4

Views: 15984

Answers (4)

Anfet
Anfet

Reputation: 417

Setting it via styles doesn't actually work, but if you set it explicitly for application it works.

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black" >

Upvotes: 1

Matt Handy
Matt Handy

Reputation: 30025

The Android system always chooses the most special values folder that fits best to your device.

As example if you have a folder values and another folder values-v14 the Android system takes resources from the latter if the device is v14 or newer.

Please refer to the Android documentation for more information.

Upvotes: 8

user1014191
user1014191

Reputation:

By default 4.0 and 4.1 give us white background but you can change it to black I face the same problem some days ago, if your project theme is set to be black then probably you change the Title while creating project to "Main" by default its "MainActivity" but if you change it to "Main" it will give you black backgrount/

I don't know my answer is relevant to your question or not but i think you talking about this if i am not wrong.

Upvotes: 0

Tomer Mor
Tomer Mor

Reputation: 8028

1.create new folder under res -> values-v13
2.create file style there and add this style :
<style name="AppTheme" parent="android:style/Theme.Holo.Light">

in your manifast use this style for your application like this

<application
        android:name=".MainApp"        
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

that way on ICS version you use the Holo.light theme and pre ICS use the default you already created

Upvotes: 3

Related Questions