首页 > 解决方案 > 未为孩子设置 StackLayout 高度

问题描述

我在 StackLayout 中添加了标签。我为 StackLayout 设置了 HeightRequest,为 Label 设置了长文本。

我想裁剪标签中的超出文本。但它会在 StackLayout 之外呈现。怎么限制。

我不想为标签设置 HeightRequest。

<StackLayout Margin="10" HeightRequest="42" BackgroundColor="Yellow">
               <Label  VerticalOptions="Center" Text="A minimum 5 characters password contains a combination of uppercase and lowercase letter and number are required. A minimum 5 characters password contains a combination of uppercase and lowercase letter and number are required."/>

           </StackLayout>

标签: androidxamarinxamarin.formslabelstacklayout

解决方案


为了根据上面代码中的 StackLayout 设置标签高度,请设置Orientation="Horizontal"for stackLayout。


推荐阅读