bul*_*loa 5 alignment xamarin xamarin.forms
我想RelativeLayout在 Xamarin.Forms 中将一张图像与顶部对齐,将一张图像与底部对齐。我怎样才能做到这一点?
<RelativeLayout>
<Image
Aspect="Fill"
Source = "header_login.png"></Image>
<Image
Aspect="Fill"
Source = "login_footer_2.png"
RelativeLayout.XConstraint=
"{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=0}"
RelativeLayout.YConstraint=
"{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=1}" ></Image>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
小智 8
我发现一些东西可能对你有用。即使不是通过使用RelativeLayout来完成,你仍然可以通过使用StackLayout得到你想要的。
这个想法是:
<StackLayout>
<StackLayout VerticalOptions="Start">
<Image/> <!--top image-->
</StackLayout>
<StackLayout VerticalOptions="CenterAndExpand">
<!-- middle controls -->
</StackLayout>
<StackLayout Orientation="Horizontal" VerticalOptions="End">
<Image/> <!--bottom image-->
</StackLayout>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
通过扩展中间 StackLayout 将剩余的空间分别推到顶部和底部。有一个固定的底部对我来说非常有用。 /sf/answers/2110020111/
| 归档时间: |
|
| 查看次数: |
7581 次 |
| 最近记录: |