问题
I am building an app and when i start launch it, it shows weird preview window wich is very diferent from the activity that i am lauching...I would like to know how to modify my theme style to have a result like this: Google contacts app photo
here is my style file with my custum theme:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.InviteToIslam" parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/MyActionBar.InviteToIslam</item>
<item name="android:dropDownListViewStyle">@style/DropDownListView</item>
</style>
<style name="MyActionBar.InviteToIslam" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@drawable/bg_actionbar_pattern</item>
</style>
<style name="MyTheme" parent="@android:style/Theme.Holo.NoActionBar">
<item name="android:windowBackground">@color/white</item>
</style>
<style name="DropDownListView" parent="@android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">@drawable/selectable_background_invitetoislam</item>
<item name="android:background">@color/white</item>
</style>
</resources>
回答1:
You should follow the instructions here.
Looks like you already have a custom theme with an overriden windowBackground
attribute, so you are halfway there.
However, I'm confused by the fact that you define two themes. Which one of them are you using for your activity in your app's manifest?
I guess it's Theme.InviteToIslam
, which would explain why your windowBackground is not changed and thus why you see a wrong color while your activity is loading. So the solution is simple, just move the windowBackground
attribute from MyTheme
to Theme.InviteToIslam
and delete MyTheme
, I don't think you'll need it.
来源:https://stackoverflow.com/questions/17664901/android-custom-preview-window