我想爲狀態欄着色,以獲得更好的Android 5.0版效果。我想要設置三種顏色的淺色,淺色和口音。主要暗色android API 21
但我最小的API是15.有沒有機會只使用API lvl 21?或者我必須用min創建一個單獨的應用程序。 sdk 21?
編輯: 現在我得到我需要的一切,但statisbar顏色不會改變。
這是我的價值觀-V21/styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="android:Theme.Material.Light">
<!-- API 21 theme customizations can go here. -->
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="android:colorPrimary">@color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">@color/accent</item>
</style>
</resources>
這正常style.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="@android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/blue</item>
</style>
</resources>
任何想法,爲什麼這是不行的?
謝謝!找不到任何關於它的事情。 – Nick 2014-10-30 19:30:30
添加了我的XML文件。它不適合我。還有黑色的狀態欄。 – Nick 2014-11-01 09:21:40
你是否指定了不同的'colors.xml'文件? – ipavl 2014-11-01 15:06:32