我已经在我的Xamarin.Forms项目中使用以下代码启用了Material主题,但是在Android(Lollipop和Marshmallow)上,顶部状态栏(其中包含时钟、信号、电池等)没有改变。它一直是黑色的。
我已经阅读了很多论坛和博客,并尝试了很多组合,但我无法使这个状态栏变成我想要的颜色。
MainActivity.cs
MainActivity.cs
[Activity(Theme = "@style/MyTheme", Label = "MyApp", Icon = "@drawable/AppIcon", ScreenOrientation = ScreenOrientation.Portrait, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
values-v21/style.xml
<resources>
<style name="MyTheme.Splash" parent="android:Theme.Material.Light">
<item name="android:windowBackground">@drawable/SplashScreen</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="MyTheme" parent="android:Theme.Material.Light">
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:colorPrimary">@color/Brand</item>
<item name="android:textColorPrimary">@color/White</item>
<item name="android:statusBarColor">@color/BrandDark</item>
<item name="android:colorPrimaryDark">@color/BrandDark</item>
<item name="android:colorAccent">@color/Brand</item>
<item name="android:textColor">@color/Brand</item>
</style>
</resources>
values/colors.xml
<resources>
<color name="SplashBackground">#f78b2b</color>
<color name="Brand">#f78b2b</color>
<color name="BrandDark">#e47108</color>
<color name="White">#ffffff</color>
</resources>
感谢您的帮助!
该句话与IT技术无关。