我的申请有问题。我有一张横跨整个屏幕 (ImageView) 的图像,其中包含以下 xml 代码:
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:src="@drawable/achtergrond"
android:scaleType="fitCenter" />
我的问题是图像位于 imageview 本身的中心。它需要居中,如下图所示:
左边的图片是我的,中间是图片。右边是我想要的,图像应该在整个布局中,我需要将我的图像设置为 match_parent 以将其填充为背景(我没有将其设置为背景,因为它会被拉伸(stretch))。
我希望我遗漏了一些明显的东西!感谢您提前帮助我!
最佳答案
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/achtergrond"
android:scaleType="fitStart" />
关于android - 使用 "match_parent"将图像对齐到顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16741074/