我有一个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>
答案 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}}