1
我想更改Android 5 Lolipop應用中導航欄和狀態欄的顏色。狀態欄和導航欄顏色不會改變
這裏是我的清單SDK設置:
<uses-sdk android:minSdkVersion="21"
android:targetSdkVersion="21"
android:maxSdkVersion="21" />
我有這個在我的my_style.xml文件:如果我改變android:colorPrimary
彩條(未狀態欄/導航欄)的
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- inherit from the material theme -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- 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>
<item name="android:statusBarColor">@color/navbar</item>
<item name="android:navigationBarColor">@color/navbar</item>
</style>
</resources>
也IDE中佈局的變化以及調試Android應用程序時的變化,但statusBarColor
和navigationBarColor
不會執行任何操作(在這裏您可以看到它應該)。我甚至試過:
getWindow.setStatusBarColor(Integer.parseInt("00FF00", 16))
但它也不起作用。我錯過了什麼嗎?
你是如何得到'getWindow'工作的?對我來說它說無法解析符號'getWindow'? – TheOddAbhi 2014-12-07 05:03:49
getWindow是在斯卡拉,在Java中你可能想getWindow() – myhau 2014-12-15 08:48:33
我能夠解決它的另一種方式。 – TheOddAbhi 2014-12-15 08:52:48