android ImageView宽度与高度设定 5

在xml文件中我是这么写的:<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="http://... 在xml文件中我是这么写的:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
>

<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/fish"
/>
</LinearLayout>
可是为什么高度远大于图片实际高度呢?该怎么解决呢?
原图片是这样:

加进去确实这样:

谁能告诉我这到底是怎么回事,求高手指点啊!
展开
 我来答
百度网友a85b46e580
2014-07-28 · TA获得超过162个赞
知道小有建树答主
回答量:255
采纳率:0%
帮助的人:181万
展开全部
给出修改后,修改的地方有数字标记
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"(1)
android:background="#ffffff"
android:orientation="vertical"(2)>
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/fish/>
</LinearLayout>
Japrace
2014-07-26 · 超过10用户采纳过TA的回答
知道答主
回答量:69
采纳率:0%
帮助的人:17万
展开全部
建议你看看ImageView的android:scaleType 属性
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
379128361
2014-07-26
知道答主
回答量:11
采纳率:0%
帮助的人:9.9万
展开全部
没看懂您想表达的意思。。您想达到什么样的效果呢?
追问
我想要图片显示在屏幕顶部,且ImageView视图的大小就是这个图片在顶部的大小,上面第二个图片表明了ImageView占据了整个屏幕,这是为什么呢?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式