Xamarin Forms Android, hide title bar border
How can I hide the border from the title bar in Xamarin Android? I am using Xamarin Forms and the following code is used in MainActivity.cs to hide the rest of the title bar.
[Activity(Label = "", MainLauncher = true, ScreenOrientation = ScreenOrientation.Portrait)]
protected override void OnCreate(Bundle bundle)
{
this.RequestWindowFeature(WindowFeatures.ActionBarOverlay);
base.OnCreate(bundle);
//Transperent Action Bar
ActionBar.SetIcon(Android.Resource.Color.Transparent);
ActionBar.SetBackgroundDrawable(new ColorDrawable(Color.ParseColor("#000000ff")));
ActionBar.SetStackedBackgroundDrawable(new ColorDrawable(Color.ParseColor("#000000ff")));
Xamarin.Forms.Forms.Init(this, bundle);
SetPage(App.GetMainPage());
}
+3
source to share
6 answers
You can use this code in your styles.xml file in Droid Project. The main thing here is to set the height to 0 dp.
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
<item name="elevation">0dp</item>
</style>
+1
source to share
Try this thread in your MainActivity.cs,
[Activity (Label = "XXX",
Theme = "@android:style/Theme.Holo.Light",
WindowSoftInputMode = SoftInput.AdjustPan,
ConfigurationChanges=global::Android.Content.PM.ConfigChanges.Orientation|global::Android.Content.PM.ConfigChanges.ScreenSize |
global::Android.Content.PM.ConfigChanges.KeyboardHidden)]
0
source to share