【问题标题】:View Containment ContainerView / Fragment Support in Forms在表单中查看包含 ContainerView / Fragment 支持
【发布时间】:2014-08-04 02:36:11
【问题描述】:

Xamarin.Forms 中是否有处理视图包含的方法?假设我想用一个容器构建一个垂直的 TabBar。通常在 iOS 中我会使用容器视图,而在 Android 中我会使用 Fragments。我将如何在 Xamarin.Forms 中执行此操作?

【问题讨论】:

  • 您找到解决方案了吗?我想实现类似的东西,但不是通过使用标签。我想同时在屏幕上显示多个ContentPages(如 Àndroid` 中的 Fragments)。
  • 不,我最终离开了 Xamarin.Forms。

标签: xamarin.ios xamarin xamarin.android xamarin.forms


【解决方案1】:

Xamarin.Forms 有一个 TabbedPage 设置子页面的标题会使用它们的文本填充选项卡。

public class MyTabbedPage: TabbedPage
{
    public MyTabbedPage()
    {
        var firstPage = new MyFirstPage
        {
            Title = "My First Page"
        };
        var secondPage = new MySecondPage
        {
            Title = "My Second Page"
        };
        Title = "Title of my Tabbed Page";
        Children.Add(firstPage);
        Children.Add(secondPage);
    }

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-03
    • 1970-01-01
    • 2021-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-17
    • 2018-12-13
    相关资源
    最近更新 更多