带有按钮的Xamarin表单选项卡

nwlls2ji  于 2022-12-07  发布在  其他
关注(0)|答案(1)|浏览(133)

我想做一个像照片上那样的设计

但是我不知道如何制作tab按钮和tab进程。我看了微软的文章和一些视频。但是没有一个是我想要的。如果你能帮助我,我会很高兴的

i2loujxw

i2loujxw1#

是的,您可以尝试使用Xamarin Community Toolkit TabView来实现这一点,就像Jason提到的那样。
您可以根据需要自定义选项卡。
请参考以下代码:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
             x:Class="MyLittleApp.MainPage">

     <Grid>
        <xct:TabView
                TabStripPlacement="Bottom"
                TabStripBackgroundColor="Blue"
                TabStripHeight="60"
                TabIndicatorColor="Yellow"
                TabContentBackgroundColor="Yellow">

                <xct:TabViewItem
                    Icon="triangle.png"
                    Text="Tab 1"
                    TextColor="White"
                    TextColorSelected="Yellow"
                    FontSize="12">
                    <Grid 
                        BackgroundColor="Gray">
                        <Label
                            HorizontalOptions="Center"
                            VerticalOptions="Center"
                            Text="TabContent1" />
                    </Grid>
                </xct:TabViewItem>

                <xct:TabViewItem
                    Icon="circle.png"
                    Text="Tab 2"
                    TextColor="White"
                    TextColorSelected="Yellow"
                    FontSize="12">
                    <Grid>
                        <Label    
                            HorizontalOptions="Center"
                            VerticalOptions="Center"
                            Text="TabContent2" />
                    </Grid>
                </xct:TabViewItem>
        </xct:TabView>
  </Grid>

</ContentPage>

注意:您也可以检查螺纹:是的。

相关问题