在android中,当我们需要一个图片浏览器时,android的提供了一个组建即为 Gallery ,可将一组图片ID ,创建一组图片预览器器。。
在创建的时候我们需要一个BaseAdapter提供 getView为Gallery提供工厂方法创造ImageView ,如果我们创建的ImageView 没有指定局部的布局方式,效果显示图片间的间隙非常大。此时我们需要指定 创建的 ImageView 的布局参数,如:
imageView.setLayoutParams(new Gallery.LayoutParams(75, 100));
我们必须自己指定布局参数
官方:.
Views given to the Gallery should use Gallery.LayoutParams
as their layout parameters type.