dafodil
dafodil

Reputation: 513

Hiding notificationbar and title bar in xamarin

In 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>

In Activity.cs

[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true )]

I used below code to hide titlebar

Window.RequestFeature(WindowFeatures.NoTitle); //This will Hide the title Bar
             this.Window.ClearFlags(WindowManagerFlags.Fullscreen); //to hide

but nothing works.How to hide both title bar and notificationbar.Anr help appreciated.

Upvotes: 1

Views: 3129

Answers (1)

Nitesh
Nitesh

Reputation: 328

Add a Theme:

'Resources/values/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>

Use the Theme:

 [Activity(Theme = "@style/Theme.NoTitle", MainLauncher = true, NoHistory = true)]

this.Window.ClearFlags(WindowManagerFlags.Fullscreen);// this hides status bar of particular activity

Upvotes: 3

Related Questions