【发布时间】:2021-05-21 09:46:07
【问题描述】:
我正在努力让我的项目在轮播视图中居中,这听起来很简单,原因与项目总是在开始时开始的原因相同。 我需要一次显示一个项目。
<StackLayout x:Name="innerStack"
HorizontalOptions="CenterAndExpand">
<Label Text="tesyt"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand"></Label>
<CarouselView HorizontalScrollBarVisibility="Never" BackgroundColor="Blue"
x:Name="carousel"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
HeightRequest="500"
> <CarouselView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal" ItemSpacing="0"/>
</CarouselView.ItemsLayout>
<CarouselView.ItemsSource >
<x:Array Type="{x:Type Label}">
<Label Text="tesyt" TextColor="Green" Margin="10,0,0,0"
></Label>
<Label Text="tesyt" TextColor="Brown"></Label>
</x:Array>
</CarouselView.ItemsSource>
</CarouselView>
</StackLayout>
【问题讨论】:
-
你试过SnapPoints吗?
标签: xamarin.forms