I want to add some label and image above tabbed page in xamarin forms, so when i slide to another tabbed page the content above tabbed page will remain the same here is the design
我可以实现这一点吗,因为我找不到任何参考资料来做到这一点?
如果您想在选项卡页面上方添加标签,则不能在选项卡页面上方添加标签,您必须创建自己的选项卡页面。
您可以创建一个根据您的选择显示/隐藏的布局创建选项卡设计并点击选项卡手势并管理布局的显示/隐藏
演示代码 Xaml 文件
<!--Tab Design-->
<StackLayout Orientation="Horizontal">
<Grid HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
ColumnSpacing="0"
RowSpacing="0"
Padding="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<!--Details Tab-->
<StackLayout Grid.Row="0"
Grid.Column="0"
Padding="7.5"
VerticalOptions="FillAndExpand">
<Button Clicked="Tab1Clicked" Text="Tab1">
</StackLayout>
<!-- Tab 2 -->
<StackLayout Grid.Row="0"
Grid.Column="2"
Padding="7.5"
VerticalOptions="FillAndExpand">
<Button Clicked="Tab2Clicked" Text="Tab2">
</StackLayout>
</Grid>
</StackLayout>
<!-- tab 1 container -->
<StackLayout x:Name="stkTab1">
</StackLayout>
<!-- tab 2 container -->
<StackLayout x:Name="stkTab2" IsVisible="false">
</StackLayout>
演示代码cs文件
private void Tab1Clicked(object sender, EventArgs e)
{
stkTab1.IsVisible=true;
stkTab2.IsVisible=false;
}
private void Tab2Clicked(object sender, EventArgs e)
{
stkTab1.IsVisible=false;
stkTab2.IsVisible=true;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)