Themeをカスタマイズ
1835 ワード
1.既存のThemeを継承(そうでないと書く属性が多すぎる)
自分のあるstyle.xmlかtheme.xmlに追加
2.具体的な属性を実現する
1). custom_list_selector_holo_light.xmlはres/drawable/の下に置いて、クリックしたり押したりして異なる効果を生む画像を指定することができます.
2). @style/CostomActonbarは自分で書いたstyleです
変更/res/values/style.xml
上の2つのプロパティは、カスタムActionBarの背景色です:wind_titlebar_background.pngとフォント顔:@*android:color/white
wind_titlebar_background.pngはActionBarの背景画像
自分のあるstyle.xmlかtheme.xmlに追加
<style name = "Theme_Custom" parent="@*android:style/Theme.Holo.Light">
<item name = "android:listChoiceBackgroundIndicator">@drawalbe/custom_list_selector_holo_light></item>
<item name = "android:actionBarStyle">@style/CustomActonbar></item>
</style>
以上カスタムリストの背景色:custom_list_selector_holo_light 2.具体的な属性を実現する
1). custom_list_selector_holo_light.xmlはres/drawable/の下に置いて、クリックしたり押したりして異なる効果を生む画像を指定することができます.
<selector xmlns:android=""http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/wind_list_focused"/>
<item android:state_focused="true"android:state_enable="true" android:drawable="@drawable/wind_list_focused"/>
</selector>
wind_list_focused.9.pngは9 patchのファイルです.2). @style/CostomActonbarは自分で書いたstyleです
変更/res/values/style.xml
<style name="WindCustomTitleTextColor" parent="@*android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name = "android:textColor">@*android:color/white</item>
</style>
<style name="WindCustomActionbar" parent="@*android:style/Widget.Holo.Light.ActionBar.Solid">
<item name = "android:background">@drawalbe/wind_titlebar_background></item>
<item name = "android:titleTextStyle">@style/WindCustomTitleTextColor></item>
</style>
上の2つのプロパティは、カスタムActionBarの背景色です:wind_titlebar_background.pngとフォント顔:@*android:color/white
wind_titlebar_background.pngはActionBarの背景画像