嗨,我是 xamarin 的新手,我遇到了 imageview 的问题。我的图像是矩形的(1080x293),但在 Imageview 中,底部和顶部的边距似乎是正方形,图像位于中间!我想在顶部对齐图像,尝试使用填充属性,设置宽度和高度但没有任何效果!我怎样才能把它放在最上面? 一些帮助将不胜感激,谢谢你,对不起这个愚蠢的问题! 这是一段代码!
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/titleIMG"
android:layout_marginBottom="0.0dp"
android:layout_marginTop="0.0dp"/>
最佳答案
几天前我遇到了同样的问题。我刚刚浏览了属性并找到了这个:“adjustViewBounds”,它允许您保留图片的真实比例。 只需将此添加到您的代码中:
android:adjustViewBounds="true"
关于android - Xamarin, ImageView 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39891961/