ImageView的占用过多的垂直空间 [英] ImageView taking too much vertical space

查看:180
本文介绍了ImageView的占用过多的垂直空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作与项目交错gridview的,可以支持不同高度每嵌套的观点,

i am working on a project with a staggered gridview that can support varying height for each nested view,

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/layout_border"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:background="@android:color/holo_blue_light" />
    </LinearLayout>

,你可以在图片中看到,宽图像的ImageView花费太多的垂直空间,
这似乎不能成为狭隘的照片的问题,
 我该如何解决这一问题?

as you can see in the pictures, for wide images the ImageView takes too much vertical space, this seems to not be an issue for narrow pictures, how do i fix this?

推荐答案

的Tamrakar建议,
StaggeredGridViewDemo 它们扩展了类ScaleImageView的ImageView
这解决了这个问题(真的不知道是什么问题,在图像周围为什么ImageView的心不是包装,而是这就是解决方案)

as Naveen Tamrakar suggested, in StaggeredGridViewDemo they extended ImageView with the class "ScaleImageView" that solved the problem (not really sure what the problem is and why ImageView isnt wrapping around the image, but that's the solution)

这篇关于ImageView的占用过多的垂直空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆