2014-12-08 53 views
3

如何隐藏Xamarin Android标题栏中的边框?我正在使用Xamarin Forms &以下代码在MainActivity.cs中用于隐藏标题栏的其余部分。Xamarin形式Android,隐藏标题栏边框

[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()); 
    } 

回答

1

我认为你应该使用的主题为

[Activity(Label = "", MainLauncher = true, Theme="@android:style/Theme.Holo.Light.NoActionBar", ScreenOrientation = ScreenOrientation.Portrait)] 

希望这将帮助你

+0

感谢会给它一个尝试 – Supreet 2014-12-08 11:52:59

+0

肯定,并让我知道之后:)可能我可以帮助你更多 – 2014-12-08 11:54:56

3

好像我没有做的Android项目具体的事情,使用下面的代码xaml.cs OnAppearing方法奏效了 //Hide Nav Bar NavigationPage.SetHasNavigationBar(this, false);

0

试试这个主题在你的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)] 
3

使用此代码

protected override void OnCreate(Bundle bundle) 
    { 
     RequestWindowFeature(WindowFeatures.NoTitle); 
     base.OnCreate(bundle); 

,我希望,如果这对你的作品

1

只要用你的NavigationPage

public HelloWorlPage() 
    { 
     InitializeComponent(); 
     NavigationPage.SetHasBackButton(this, false); 
     NavigationPage.SetHasNavigationBar(this, false); 
    }