如何减少物品xamarin形式之间的间距

时间:2017-07-26 17:58:35

标签: xamarin

我有一个StackLayout和一个标签,两者之间的间距非常大,我想减少,以便两者尽可能地靠近,我以什么方式做到这一点

       <ScrollView BackgroundColor="#ffffff" Padding="15">
   <StackLayout HorizontalOptions="Fill" VerticalOptions="FillAndExpand">
        <Image Source="{Binding Image}" HeightRequest="200"  x:Name="image">
              <Image.GestureRecognizers>
                <TapGestureRecognizer Tapped="OnTapped" />
              </Image.GestureRecognizers>
            </Image>

        <StackLayout Orientation="Horizontal" Spacing="0">
            <Button x:Name="Amais" Text="A+" />
            <Button x:Name="Amenos" Text="A-" />
       </StackLayout>

        <Label x:Name="webView" VerticalOptions="FillAndExpand" FontSize="18"/>
    </StackLayout>
 </ScrollView>

enter image description here

1 个答案:

答案 0 :(得分:1)

*修改:让我们再试一次,将Spacing设置为父0上的StackLayout,然后移除VerticalOptions上的Label和父级StackLayout <ScrollView BackgroundColor="#ffffff" Padding="15"> <StackLayout HorizontalOptions="Fill" Spacing="0"> <Image Source="{Binding Image}" HeightRequest="200" x:Name="image"> <Image.GestureRecognizers> <TapGestureRecognizer Tapped="OnTapped" /> </Image.GestureRecognizers> </Image> <StackLayout Orientation="Horizontal"> <Button x:Name="Amais" Text="A+" /> <Button x:Name="Amenos" Text="A-" /> </StackLayout> <Label x:Name="webView" FontSize="18"/> </StackLayout> </ScrollView> 。这会让你得到你的结果吗?

{{1}}