我遇到了Xamarin.Forms和Label的問題。 我試圖在網格列上設置標籤。Xamarin Forms XAML標籤旋轉
這裏的第一張圖片顯示了預期的結果,這是用Android上的AXML編寫的。
這裏的第二圖像被寫在XAML中Xamarin.Forms。
在XAML文件中的代碼如下:
<Grid
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400*"/>
<ColumnDefinition Width="75*"/>
</Grid.ColumnDefinitions>
<WebView Source="{Binding ContentSource}" />
<!--<ProgressBar IsVisible="{Binding IsLoading}"
Progress="{Binding Progress}"/>-->
<Grid Grid.Column="1"
BackgroundColor="#EE7F00"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand">
<Label
Text="{Binding DocumentIndex}"
LineBreakMode="NoWrap"
HorizontalOptions="Center"
Rotation="-90"
VerticalOptions="Center" />
</Grid>
</Grid>
如何展開標籤的高度或寬度等於所述文本長度?
謝謝到目前爲止
使用CenterAndExpand而不是您的標籤上的中心進行嘗試。 – Cheesebaron
不適用於我。 – MBZ
我面對同樣的問題,即使在旋轉後,標籤也會呈現父級寬度。增加標籤字體/文本會增加父寬度,因此需要將此文件作爲Xamarin Bugzilla(https://bugzilla.xamarin.com/)中的錯誤進行存檔。 –