如何设置网格的图像具有均匀的高度和宽度 [英] How to set Grid images have uniform height and width

查看:155
本文介绍了如何设置网格的图像具有均匀的高度和宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友的
    我有一个任务解析缩略图,并把它放在网格视图,其中URL图像内容是在不同的高度和宽度(一些图像是60 * 60或110 * 80),如何设置图像网格有统一的高度和宽度。

Friend's I have a task to parse thumbnail images and to set it on grid view,where url image content to be in different height and width(some images to be 60*60, or 110*80),how can i set images in grid have uniform height and width.

先谢谢了。

推荐答案

给你的布局由ListAdapter一个固定的宽度和高度足以最大尺寸创建的视图,然后放置里面例如中心的ImageView的:

Give your layout for the views created by the ListAdapter a fixed width and height sufficient for the largest dimensions, then position the ImageView centered inside e.g.:

<RelativeLayout 
     android:id="@+id/RelativeLayout01" 
     android:layout_width="100dip" 
     android:layout_height="80dip"    
     xmlns:android="http://schemas.android.com/apk/res/android">
     <ImageView 
          android:id="@+id/imageView" 
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent"
          android:scaleType="centerInside">
    </ImageView>
</RelativeLayout>

这篇关于如何设置网格的图像具有均匀的高度和宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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