我想在Xamarin.Forms中的RelativeLayout中将一张图片对齐到顶部,另一张图片对齐到底部。该怎么做?
<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>
StackLayout
中添加VerticalOptions="FillAndExpand"
才能使其正常工作。同时,请确保您拥有与答案中提到的中间控件StackLayout
相对应的视图,并且该视图可以展开
,否则它可能无法正常工作。 - Jonathan