我创建了一个Xamarin Forms项目,我无法将Android状态栏颜色更改为透明。我编程改变我的颜色我的MainActivity的onCreate()方法如下:Xamarin Forms Android透明状态栏
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
{
Window.ClearFlags(WindowManagerFlags.TranslucentStatus);
Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
Window.SetStatusBarColor(Color.Transparent);
}
我尝试不同的颜色和它的工作很好,但“透明”是不工作的。我在API测试22
我style.xml情况如下:
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/blue</item>
<item name="colorPrimaryDark">@color/blue</item>
<item name="colorAccent">#FF4081</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
如果我例如,将没有问题的工作程序我的颜色设置为紫色,但如果我设置为透明,我会得到我的style.xml颜色是蓝色的。如果我删除我的style.xml ColorPrimaryDark颜色,我会得到一个灰色的状态栏。什么可能是解决方案?
的可能的复制[棒棒糖:绘制后面用的状态栏的颜色设置为透明(http://stackoverflow.com/questions/27856603/lollipop-draw-behind-statusbar-with-its-color-set - 透明) –