在 Styles.xml 中
<style name="MyTheme.Splash" parent ="Theme.AppCompat.Light">
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowNoTitle">true</item>
</style>
在 Activity.cs 中
[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true )]
我用下面的代码隐藏了标题栏
Window.RequestFeature(WindowFeatures.NoTitle); //This will Hide the title Bar
this.Window.ClearFlags(WindowManagerFlags.Fullscreen); //to hide
但没有任何效果。如何隐藏标题栏和通知栏。感谢您的帮助。
最佳答案
添加主题:
'资源/值/NoTitleTheme.xml'
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="Theme.NoTitle" parent="android:Theme">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
使用主题:
[Activity(Theme = "@style/Theme.NoTitle", MainLauncher = true, NoHistory = true)]
this.Window.ClearFlags(WindowManagerFlags.Fullscreen);// this hides status bar of particular activity
关于c# - 在 xamarin 中隐藏通知栏和标题栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36371396/