如何在标签页之前添加内容页或视图

如何在标签页之前添加内容页或视图

本文介绍了如何在标签页之前添加内容页或视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 TabbedPage 之前添加页面/视图,我该怎么做?

I want to add Page/View before TabbedPage, how can I do that?

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
     xmlns:views="clr-namespace:TestProject.TabbedPages"
     x:Class="TestProject.ItemPage"
     Title = "Home Page">
    <TabbedPage.Children>
    <views:AprovedLeaves Title="Approved leaves"/>
    <views:PendingLeaves Title="Pending leaves"/>
    <views:DeniedLeaves Title="Denied leaves"/>
    </TabbedPage.Children>
</TabbedPage>

上面的代码显示了这样的输出

Above code showing output like this

但我在制表符前需要一些空格.像这样

But I need some space before tabs. Like this

推荐答案

我建议您使用 Segmented Control Plugin 在 Nuget 上查找 Plugin.Segmented 并安装 Plugin.SegmentedControl.NetStandard

I would suggest you use the Segmented Control Plugin for this look for Plugin.Segmentedon Nuget and install Plugin.SegmentedControl.NetStandard

在 iOS 上像这样初始化它:

Initialize it on iOS something like this:

 SegementedControlRenderer.Initialize();

然后像这样在XAML中使用它

Then use it in XAML like this

  <control:SegmentedControl x:Name="SegmentedControl" SelectedSegment="{Binding SegmentSelection}" TintColor="White" SelectedTextColor="BlueViolet" DisabledColor="Gray" Margin="8,8,8,8">
        <control:SegmentedControl.Children>
            <control:SegmentedControlOption Text="Item 1" />
            <control:SegmentedControlOption Text="Item 2" />
            <control:SegmentedControlOption Text="Item 3" />
            <control:SegmentedControlOption Text="Item 4" />
        </control:SegmentedControl.Children>
    </control:SegmentedControl>

C# 上提供了分步指南角落博客

如有查询,请随时回复

这篇关于如何在标签页之前添加内容页或视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 16:20