Ale*_*vic 6 grid android label xamarin xamarin.forms
位于固定大小网格行中的 Xamarin.Forms 标签的文本被截断,或者更确切地说,它显示了太多文本,并且由于网格行的固定高度,最低行仅显示一半。网格行高必须保持固定。
gridInner.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.8, GridUnitType.Star) });
gridInner.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(7.5, GridUnitType.Star) });
gridInner.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.7, GridUnitType.Star) });
var descLabel = new Label()
{
HorizontalOptions = LayoutOptions.StartAndExpand,
VerticalOptions = LayoutOptions.Fill,
FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
FontAttributes = FontAttributes.None,
TextColor = Color.Black,
LineBreakMode = LineBreakMode.WordWrap,
VerticalTextAlignment = TextAlignment.Start
};
descLabel.SetBinding(Label.TextProperty, "Offer.Description");
gridInner.Children.Add(descLabel, 0, 1);
Run Code Online (Sandbox Code Playgroud)
在我看来,标签的高度大于网格行的高度,或者文本行高度计算错误。我已经尝试了所有我能想到的方法,例如:
<style name="App_TextViewStyle" parent="@android:style/Widget.TextView">
<item name="android:baselineAligned">false</item>
<item name="android:includeFontPadding">false</item>
<item name="android:padding">1dp</item>
</style>
Run Code Online (Sandbox Code Playgroud)
任何在 XF 方面更有经验的人都可以对我有所了解吗?
归档时间: |
|
查看次数: |
4352 次 |
最近记录: |