新浪博客

android-ImageView在图像的顶部和底部显示空白

2023-06-19 15:37阅读:
我在 android 布局中添加图像。图像的顶部和底部没有空白,但是当我在 imageView 中添加图像时,它会在图像的顶部和底部显示空白。 因此,如果我想在图像和 TextView 之间的图像空间的正下方添加 TextView 。
我不明白为什么 imageview 在图像的顶部和底部显示空白。我没有添加任何东西,比如 android:padding 等等。
<<span class='hljs-name'>ImageView android:id='@+id/imageView3' android:layout_width='wrap_content' android:layout_height='match_parent' android:layout_alignParentLeft='true' android:layout_alignParentTop='true' android:src='@drawable/img1' />
最佳答案
将这些属性添加到ImageView
android:adjustViewBounds='true' android:cropToPadding='false' android:scaleType='fitXY'
关于android - ImageView 在图像的顶部和底部显
示空白,我们在Stack Overflow上找到一个类似的问题: /questions/25382320/

我的更多文章

下载客户端阅读体验更佳

APP专享