<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" VerticalOptions="Start"
HeightRequest="100" WidthRequest="10" Padding="20,20,20,0" BackgroundColor="#272626">
<Label x:Name="lb_headname" Text="xxxxx" TextColor="White" HorizontalOptions="CenterAndExpand"
VerticalOptions="Start" HeightRequest="30" />
<Label x:Name="lb_bnfit" Text="100" TextColor="#ffde72" FontSize="Large"
HorizontalOptions="CenterAndExpand" VerticalOptions="Start"
HeightRequest="40" />
</StackLayout>
1. 线性布局StackLayout,里面从上到下放标签Label,每行只放一个标签。
第一行的标签是标题,内容不变,第二行标签的内容会在Onappearing事件里面变更赋值。
这时候任何其他看起来合理的属性,比如HorizontalOptions="Center",HorizontalTextAlignment="Center" WidthRequest="200",第一行没有影响,第二行标签,在安卓运行后app内切换没有问题,但是切换到手机桌面再回到App的时候,标签的文字内容就不居中了,而是居左。经过许多测试,目前以上代码为可用的布局。
2. 待续...