【问题标题】:How to remove empty space in StackLayout - Xamarin如何删除 StackLayout 中的空白空间 - Xamarin
【发布时间】:2022-01-17 00:23:02
【问题描述】:

我有一个带有一个按钮和两个标签的 StackLayout。

我想删除 StackLayout 和按钮之间的空白。

我使用 Spacing = "0" 但这不适合我。

 <StackLayout VerticalOptions="EndAndExpand"
                 HorizontalOptions="EndAndExpand"
                 Spacing="0">
          <Button Text="ОФИЦИАЛЕН WEB САЙТ"
                                VerticalOptions="CenterAndExpand"
                                HorizontalOptions="Center"
                                Clicked="OnButtonClickedWeb"
                                x:Name="webButton"
                                WidthRequest="150"
                                HeightRequest="30"
                                FontSize="10"/>
         <Label Text="Създаден от Благовест Пижев, тел: +359 899 91 66 79, е-mail: pizhevsoft@gmail.com" 
              HorizontalOptions="CenterAndExpand"
              VerticalOptions="EndAndExpand"
              HorizontalTextAlignment="Center"
              VerticalTextAlignment="Center"
              FontAttributes="Bold"
              FontSize="10"
              TextColor="White"/>
       <Label Text="Финансирано по програма ННП 'Млади учени, докторанти и постдокторанти.' от МОН. НИМХ - Филиал Пловдив." 
              HorizontalOptions="EndAndExpand"
              VerticalOptions="EndAndExpand"
              HorizontalTextAlignment="Center"
              VerticalTextAlignment="Center"
              FontAttributes="Bold"
              FontSize="10"
              TextColor="White"/>
    </StackLayout>

当我使用 HeighRequest 时,标签的歌词不可见并向下显示。

【问题讨论】:

  • 你确定问题不在 StackLayout 和它之前的任何元素之间吗?
  • 当我输入 HeightRequest = "200" 时,stacklayout 正在缩小,我无法将高度降低到 90 以下。为什么?
  • 我不知道这与我问你的问题有什么关系。我建议您将 BG 颜色分配给 UI 中的所有元素,以便您可以直观地看到间距的实际位置。

标签: c# android xamarin


【解决方案1】:

您可以添加填充属性 填充=“0”

您也可以(如果需要)添加 Margin="0,-10,0,0"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-09
    • 2017-01-27
    • 1970-01-01
    • 2021-08-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多