将Android状态栏设置为完全透明无法正常工作
我正在使用Xamarin.Forms构建我的移动应用程序,目前我无法将Android平台中的状态栏设置为完全透明的(如本文所示) 因为我使用的是xamarin.forms,所以我只想使用Android的style.xml 我已经看完这篇文章了 以及其他一些类似的帖子,并尝试了同样的方法,但我仍然无法让它正常工作 以下是my styles.xml:将Android状态栏设置为完全透明无法正常工作,android,android-layout,xamarin.forms,android-actionbar,android-statusbar,Android,Android Layout,Xamarin.forms,Android Actionbar,Android Statusbar,我正在使用Xamarin.Forms构建我的移动应用程序,目前我无法将Android平台中的状态栏设置为完全透明的(如本文所示) 因为我使用的是xamarin.forms,所以我只想使用Android的style.xml 我已经看完这篇文章了 以及其他一些类似的帖子,并尝试了同样的方法,但我仍然无法让它正常工作 以下是my styles.xml: <style name="MainTheme" parent="MainTheme.Base"> </style>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<style name="SplashTheme" parent="MainTheme.Base">
<item name="android:windowBackground">@drawable/splash_screen</item>
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#2196F3</item>
<item name="colorPrimaryDark">#1976D2</item>
<item name="colorAccent">#FF4081</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF4081</item>
</style>
</resources>
@可拉伸/飞溅屏幕
真的
假的
#2196F3
#1976D2
#FF4081
真的
@样式/应用程序对话框样式
@android:彩色/透明
@android:彩色/透明
假的
真的
真的
#FF4081
以下是我的启动屏幕xml:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap
android:src="@drawable/splash"
android:tileMode="disabled"
android:gravity="fill_horizontal|fill_vertical"
/>
</item>
</layer-list>
我能够通过状态栏获得我想要的结果,但是导航栏仍然存在问题。
图片如下:
如图所示,导航栏占据了我的应用程序内容的空间
另外,当我将android:windowTranslucentNavigation更改为false时,会产生类似于此图的结果,条形图的位置正确,但颜色很差
此外,我需要改变的内容颜色的酒吧,以较深的颜色,而不是白色像这些图像
所以我的问题是,我如何让我的状态栏颜色完全透明,导航栏半透明,就像我的前两张图片一样,它们的位置就像我的上一张图片一样,只需在styles.xml中设置即可
非常感谢您的帮助。可能有点懒惰,但如果没有其他人给出答案,您可以在底部和顶部添加填充,这样当您将状态栏/导航栏设置为半透明时,它不会重叠,而忽略颜色。因此,第1步,禁用半透明导航
false
接下来,您的窗口负责在状态栏和导航栏后面绘制内容。我建议你把你的问题简化为“我如何在状态栏和导航栏后面画图”,这样人们就不会进来,建议第一步然后离开(就像我正要离开一样)。可能有点懒惰,但如果没有其他人给出答案,您可以在底部和顶部添加填充,这样它就不会重叠。当您将状态栏/导航栏设置为半透明时,它将忽略颜色。因此,第1步,禁用半透明导航false
接下来,您的窗口负责在状态栏和导航栏后面绘制内容。我建议你把你的问题简化为“我如何在状态栏和导航栏后面画图”,这样人们就不会进来,建议第一步然后离开(就像我正要离开一样)。