我尝试将两张图片放在布局的中心, 但我在布局的顶部和底部有额外的空间。 图像是 png 文件。
我的 XML 的重要部分如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/backDark2"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/imageDriverProfileFace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:src="@drawable/driver"
/>
<ImageView
android:id="@+id/imageDriverProfileCar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:src="@drawable/car"
/>
</LinearLayout>
请问如何删除提到的额外空间? 谢谢!
最佳答案
将 android:adjustViewBounds="true"
参数设置为您的 ImageView
关于android - 我无法将两张图片放在布局的中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29877924/