简体   繁体   English

Xamarin Forms Master Detail页面包含在父页面中

[英]Xamarin Forms Master Detail Page is contained within parent page

I have a simple master detail page, but for some reason the master page seems to be contained within the detail view. 我有一个简单的母版详细信息页面,但是由于某种原因,母版页面似乎包含在详细信息视图中。 In other words, the menu starts where the detail navigation bar ends -- I would expect the master page to start at the top of the screen. 换句话说,菜单从详细信息导航栏结束的地方开始-我希望母版页从屏幕顶部开始。 What's the deal? 这是怎么回事?

主详细页面

    public class MasterPage : MasterDetailPage
    {
        public MasterPage(Sdk.Application context)
        {
            Title = "Master Page";

            this.Master = new MenuPage();
            this.Detail = DetailPage();

            IsPresented = true;
        }            
    }


    private NavPage DetailPage()
    {
        var result = new NavPage(new BasePage { Title = "Empty" });

        ... populate page content ...

        return result;
    }

You must set on Android Proyect in your main Activity use AppCompat instead of FormsApplicationActivity so you see the Master get over the navigation bar: 您必须在Android Proyect的主Activity中使用AppCompat而不是FormsApplicationActivity进行设置,这样您才能看到Master越过导航栏:

public class MainActivity : FormsAppCompatActivity 公共类MainActivity:FormsAppCompatActivity

Here is a great blog post on how to achieve that! 是一篇很棒的博客文章,介绍如何实现这一目标!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM