android– 图片高度太高了

android– 图片高度太高了,第1张

概述我试图设置一个屏幕的一部分,其中4个图像彼此相邻,但根据图像示例,它们之间有巨大的空白区域:我希望他们能够彼此相邻.下面是我使用的XML:<LinearLayoutxmlns:android="http://schemas.android.com/apkes/android"android:layout_width="fill_parent"

我试图设置一个屏幕的一部分,其中4个图像彼此相邻,但根据图像示例,它们之间有巨大的空白区域:

我希望他们能够彼此相邻.下面是我使用的XML:

<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content"          androID:orIEntation="vertical"><linearLayout    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content"    >    <ImageVIEw        androID:layout_wIDth="0dp"        androID:layout_height="wrap_content"        androID:ID="@+ID/imageVIEw1"        androID:src="@drawable/test1"        androID:layout_weight="1"/>    <ImageVIEw        androID:layout_wIDth="0dp"        androID:layout_height="wrap_content"        androID:ID="@+ID/imageVIEw2"        androID:src="@drawable/test"        androID:layout_weight="1"/></linearLayout><linearLayout    androID:orIEntation="horizontal"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent">    <ImageVIEw        androID:layout_wIDth="0dp"        androID:layout_height="wrap_content"        androID:ID="@+ID/imageVIEw3"        androID:src="@drawable/test1"        androID:layout_weight="1"/>    <ImageVIEw        androID:layout_wIDth="0dp"        androID:layout_height="wrap_content"        androID:ID="@+ID/imageVIEw4"        androID:src="@drawable/test"        androID:layout_weight="1"/></linearLayout>

我也试图让他们到屏幕的顶部,但白色空间阻止了这一点.

你看到的图像根本没有任何空白区域,颜色的边缘是图像的边缘?

谢谢

解决方法:

您需要将scaleType设置为centerInsIDe,并将adjustVIEwBounds设置为true,如下所示:(调整视图边界应该摆脱您不想要的空间.)

   <ImageVIEw        ...        androID:layout_height="wrap_content"        androID:scaleType="centerInsIDe"        androID:adjustVIEwBounds="true" />
总结

以上是内存溢出为你收集整理的android – 图片高度太高了全部内容,希望文章能够帮你解决android – 图片高度太高了所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1115698.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存