我已经定义了
<item name="android:statusBarColor">@color/some_color</item>
<item name="android:navigationBarColor">@color/some_color2</item>
它在使用API 22的模拟器中运行良好但在我的华为中具有相同的Android版状态栏和导航栏颜色不起作用。它和以前一样。
我可以补充一点,android:textApperance
或android:background
这样的其他属性可以正常使用这两个属性。
答案 0 :(得分:0)
这是你的values / styles.xml
<style name="MyMaterialTheme" parent="Theme.AppCompat.Light">
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">@color/my_awesome_color</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">@color/my_awesome_darker_color</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">@color/accent</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight & colorSwitchThumbNormal. -->
</style>
并将此主题设置为您在显示中的活动 像这样
<activity
android:name=".MainHomeFragmentActivity"
android:theme="@style/MyMaterialTheme" />
答案 1 :(得分:0)
华为没有在基于Lollipop 5.1.1的EMUI 3.1中实现,它具有状态栏的颜色。所以有两种方法可以解决它。
1-) 您需要的文件:
[emui3.1.png https://drive.google.com/file/d/0BwQ4XeikVQ3kU2ZNVW53UFQ4WDQ/view?usp=sharing]
[emui3.1bg.png https://drive.google.com/file/d/0BwQ4XeikVQ3kVnh5UTBrS3F4aW8/view?usp=sharing]
这是来自EMUI官方BBS的EMUI主题(此主题效果不错,但没有半透明状态栏):https://drive.google.com/file/d/0BwQ4XeikVQ3kRmdSZ19LblpiQ00/view?usp=sharing
华为启动者这是一个教程:https://www.youtube.com/watch?v=HTweBQgjXr8
2-)您需要root设备。您可以在此处查看root:https://www.kingoapp.com/root-huawei.htm
然后[https://drive.google.com/file/d/0BwQ4XeikVQ3kZGJDMWpuSGF0bDA/view?usp=sharing]只需点亮此拉链