【发布时间】:2019-12-05 21:05:25
【问题描述】:
我有问题。我正在尝试将我的 ImageButton 对齐到页面底部,因此我创建了以下代码:
<RelativeLayout VerticalOptions="FillAndExpand">
<StackLayout Orientation="Vertical" x:Name="MainLayout" VerticalOptions="Center">
<Grid x:Name="GridUpperControl">
....
</Grid>
<Grid x:Name="GridBottomControl">
....
</Grid>
</StackLayout>
<StackLayout VerticalOptions="End" Orientation="Horizontal">
<ImageButton Source="ActionButton_Continue.png" BackgroundColor="Transparent"
HorizontalOptions="End" Margin="0, 0, 15, 15"
WidthRequest="80" HeightRequest="80" />
</StackLayout>
</RelativeLayout>
但问题出在这里,两个堆栈布局都在顶部对齐.... 我做错了什么?
【问题讨论】:
-
您在这里使用相对布局作为外部容器。要在相对布局中定位元素,您需要使用约束。见docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/…
标签: xaml xamarin xamarin.forms xamarin.android xamarin.ios