【发布时间】:2016-04-17 13:36:50
【问题描述】:
我使用以下代码在我的 Xamarin.Forms 项目上启用了 Material 主题,但在 Android(棒棒糖和棉花糖)上,顶部状态栏(时钟、信号、电池等所在的位置)没有改变.它始终保持黑色。 我已经阅读了很多论坛和博客,尝试了很多组合,但我无法让这个状态栏按我的意愿着色。
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>
感谢您的帮助!
【问题讨论】:
标签: xamarin material-design xamarin.forms statusbar android-theme