c# - 在 xamarin 中隐藏通知栏和标题栏

标签 c# android xamarin

在 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/

相关文章:

android - 加速启动一个简单的android Activity

java - 使用 SQLitestatement bindstring 方法代替简单的字符串连接来执行 sql 语句有什么优点

android - 更改应用栏背景颜色

c# - Xamarin - Android - Visual Studio - 应用程序无法启动

android - 防止应用程序在方向更改期间重新启动

c# - mono 的 mdb 文件与 csc 的 pdb 文件

c# - 在 Xamarin 表单中实现分层 StackLayout 的延迟加载

c# - 无法订阅使用 dday.ical 创建的 webcal 提要

c# - 如何在 C# 标记中将框架的高度设置为其宽度?

c# - C#/Visual Studio 的 JDT 等效项