【问题标题】:How to change the Frame / Position of the Tab bar in Xamarin forms?如何更改 Xamarin 表单中标签栏的框架/位置?
【发布时间】:2018-10-17 04:31:58
【问题描述】:

我是 Xamarin Forms 和 C# 的新手。 现在我想在我的 Xamarin Forms 应用中实现 Tabbar。

为此,我使用了以下代码

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Project.Views.DummyPage111">

    <TabbedPage.Children>

        <ContentPage Title="Tab 1">
            <Label Text="Page 1" />
        </ContentPage>

        <ContentPage Title="Tab 2">
            <Label Text="Page 2" />
        </ContentPage>

        <ContentPage Title="Tab 3">
            <Label Text="Page 3" />
        </ContentPage>

        <ContentPage Title="Tab 4">
            <Label Text="Page 4" />
        </ContentPage>
    </TabbedPage.Children>

</TabbedPage> 

它在 Android 和 iOS 中都可以正常工作,但是我需要在 iOS 和 Android 的屏幕顶部保持标签栏的位置。 因此,为此我需要将标签栏移动到我的应用程序的顶部位置。

我需要自定义标签栏位置。

【问题讨论】:

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


    【解决方案1】:

    你可以参考这个Set Tabbar position to Top for iOS in Xamarin.Forms
    在 iOS 中为标签页制作自定义渲染器,它将标签栏放在顶部位置

    希望这可以解决您的问题。

    【讨论】:

    • 谢谢,但是这个项目在 Mac mini 上并没有运行在 Android 和 iOS 上。
    • 我已经尝试过这个示例解决方案,它对我来说工作正常,你可以在你的项目中试用 iOS 的渲染器,它可能会解决你的问题!
    • 它在Windows系统中运行并在Android中启动标签栏。但是,当我尝试在我的 Mac Mini 上运行时,它并没有在 iOS 中运行,也没有启动 iOS 应用程序。
    • 此链接现已失效。有新链接吗?
    • @Kyle 你可以试试下面的链接,如果它适合你:stackoverflow.com/questions/45741361/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-09-30
    • 2019-11-16
    • 2017-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多