在(相对)新的 Xamarin 表单中,我试图将图像垂直对齐到滚动视图的底部。
这是我的代码,这正是我想要的(对于滚动的较大图像)。但是当我有一个小于设备高度的图像时,它应该与屏幕底部对齐,而不是屏幕的中心(可能是默认值)。由于文档(仍然)缺乏,我怎样才能在代码中实现这一点?
return new ContentPage {
Content = new ScrollView {
Orientation = ScrollOrientation.Vertical,
BackgroundColor = Color.Black,
Content = new Image {
Source = ImageSource.FromFile (image)
}
}
};
我已经尝试过了,但它给出了一个错误,即以下方法或属性之间的调用不明确......
RelativeLayout rl = new RelativeLayout ();
rl.Children.Add (new ScrollView {
Orientation = ScrollOrientation.Vertical,
BackgroundColor = Color.Black,
Content = new Image {
Source = ImageSource.FromFile (image)
}
});
return new ContentPage {
Content = rl
};