我有一个带相对布局>网格(1row,1col)的xaml页面ActivityIndicator(1row,1col)网格有一个滚动视图,它有一个stacklayout和一个按钮 . Stacklayout有一个带有空白文本和verticaloption设置为FillAndExpand的标签 .
在页面上显示我从服务获取值并更改标签值 .
Issue: 因为标签是高度为0的渲染,如果我将标签的默认值设置为"something",标签的高度为= 1行,只有1行文本可见 . 如果我将它设置为类似于"\n\n\n\n\n multiple times"的东西,我会按预期在页面中获得滚动条,但标签的高度等于\ n \ n \ n count并且不等于出现的内容 .
我可以改变什么来解决这个问题?如果需要代码,我可以把它放在这里 .
<RelativeLayout>
<Grid Padding="0" RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ScrollView x:Name="Scroller1" Grid.Row="0" Grid.Column="0" BackgroundColor="Aqua">
<StackLayout x:Name="Stack1" Padding="20,20,20,0" BackgroundColor="Fuchsia">
<Label x:Name="Label1" VerticalOptions="FillAndExpand" BackgroundColor="Lime" Text="{Binding DisclaimerText}" />
</StackLayout>
</ScrollView>
<Button Command="{Binding AgreeBtnTapCommand}" HeightRequest="50" Grid.Row="1" Grid.Column="0" BorderRadius="0" Text="Agree" TextColor="White" >
</Button>
</Grid>
<controls:PageActivityIndicator RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}" RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height}" IsVisible="{Binding IsBusy}" />
</RelativeLayout>