微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Xamarin Style IndicatorView看起来像TabbedPage

如何解决Xamarin Style IndicatorView看起来像TabbedPage

我有问题。我最近遇到了一个问题:Xamarin forms Add button in TabbedPage,但是使用公认的anwser可以解决此问题。简而言之,我使用的是CarouselViewIndicatorView,因此可以在多个屏幕上覆盖。这两个视图都替换了我的TabbedPage,但是IndicatorView必须看起来像TabbedPageBar。关于样式IndicatorView的唯一不错的页面是:https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/indicatorview

这是我的页面

<StackLayout AbsoluteLayout.LayoutBounds="0,1,1"
            AbsoluteLayout.LayoutFlags="All"
            Padding="0"
            Spacing="0">

    <IndicatorView x:Name="indicatorView">
        <IndicatorView.IndicatorTemplate>
            <DataTemplate>
                <StackLayout HorizontalOptions="FillAndExpand">
                    <Frame Margin="10">
                        <Label/>
                    </Frame>
                </StackLayout>
            </DataTemplate>
        </IndicatorView.IndicatorTemplate>
    </IndicatorView>

    <CarouselView ItemTemplate="{StaticResource templateSelector}"
                IndicatorView="indicatorView">
        <CarouselView.ItemsSource>
            <x:Array Type="{x:Type x:String}">
                <x:String>1</x:String>
                <x:String>2</x:String>
                <x:String>3</x:String>
            </x:Array>
        </CarouselView.ItemsSource>
    </CarouselView>

</StackLayout>

现在如何让IndicatorView看起来像TabbedPageBar

解决方法

我认为这里的重点是删除Shadow的{​​{1}}和CornerRadius,然后您可以自定义框架中的布局。这是一个示例:

Frame

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。