如何设置应用在 Kitkat 设备上运行时状态栏的半透明模式以及应用在 Lollipop 设备上运行时的不同颜色模式?
这是我在values和values-v21文件夹中的styles.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#2196F3</item>
<item name="colorPrimaryDark">#0D47A1</item>
</style>
这是 value-v19 文件夹中我的 styles.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#2196F3</item>
<item name="colorPrimaryDark">#0D47A1</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
最佳答案
如果您要为不同的 API 版本创建不同的样式,则必须使用不同的文件夹而不是不同的文件名。
res/values-vXX
您正在使用 styles-v19.xml 和 styles-v21.xml:它不一样!
例如使用类似的内容:
res/values/styles.xml
res/values-v19/styles.xml
res/values-v21/styles.xml
关于android - Android 4.4和5.0中不同的状态栏样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29664360/