<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. 待續...