自动在堆叠布局中堆叠标签,没有边距

时间:2019-02-26 18:56:48

标签: xamarin stacklayout

我在无法将两个标签堆叠在StackLayout中并且无法容纳内容的情况下遇到问题。

预期结果: enter image description here

当前输出:

enter image description here

我尝试并设置了VerticalOptionsMarginPadding属性,但是它仍然包含边距(红色背景),并且第二个内容没有触及“天花板StackLayout的父级。

当前代码:

<ViewCell>
    <StackLayout Orientation="Horizontal" VerticalOptions="Start">
    <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
        <Image Source="summary.png"/>
    </StackLayout>
    <StackLayout Orientation="Vertical" VerticalOptions="Start" BackgroundColor="Red" Margin="0" Padding="0">
        <StackLayout BindingContext="{Binding Date}" VerticalOptions="Start" BackgroundColor="Beige" Margin="0" Padding="0">
          <Label Text="{Binding Text}" TextColor="{Binding Color}" VerticalOptions="Start"/>
        </StackLayout>
        <StackLayout BindingContext="{Binding Result}" VerticalOptions="Start" BackgroundColor="Blue" Margin="0" Padding="0">
          <Label Text="{Binding Text}" TextColor="{Binding Color}" FontSize="{Binding FontSize}" VerticalOptions="Start"/>
        </StackLayout>    
    </StackLayout>                                
    </StackLayout>
</ViewCell>

0 个答案:

没有答案