Issue
I want to change pages in Xamarin Forms, to do this I have read that you need to use a NavigationPage as the root page. My problem is I can't get rid of the navigation bar at the top. I have tried using SetHasNavigationBar but it doesnt seem to work
public App ()
{
NavigationPage mypage = new NavigationPage (new PageOne ());
NavigationPage.SetHasNavigationBar (mypage, false);
MainPage = mypage;
}
Result: http://i870.photobucket.com/albums/ab261/j0sht/prob_zps4bmxtyvb.png
As you can see from the image, there is still a bar at the top with an icon
Thanks
Solution
I believe you have to call NavigationPage.SetHasNavigationBar () on the inner page, not the NavigationPage (mypage in your case) try doing the following:
var pageOne = new PageOne();
NavigationPage.SetHasNavigationBar (pageOne, false);
NavigationPage mypage = new NavigationPage (pageOne);
MainPage = mypage;
Edit with how to eliminate nav bar from loading screen on Android (basically set a dummy splash page with simple image background, and redirect to your real main activity on load (at which point Xamarin Forms takes over):
[Activity(MainLauncher = true, NoHistory = true, Theme = "@style/Theme.Splash",
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class SplashScreen : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var intent = new Intent(this, typeof(MainActivity));
StartActivity(intent);
}
}
and the Theme for the splash screen:
<style name="Theme.Splash" parent="android:Theme">
<item name="android:windowBackground">@drawable/splashscreen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
Answered By - codechinchilla
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.