加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

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

(2023-06-19 15:37:20)
分类: androidios

我在 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/

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有