开发者

to much space between images in gallery android

开发者 https://www.devze.com 2023-02-17 04:40 出处:网络
Hello i have an activity that loads lots of images from the drawable folder, and put them in a gallery view from an Adapter. The problem is that there\'s too much space between this images.

Hello i have an activity that loads lots of images from the drawable folder, and put them in a gallery view from an Adapter. The problem is that there's too much space between this images.

Here's the getView i use:

public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView == null) { 
            convertView = new ImageView(mContext);
            convertView开发者_高级运维.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        }
        ImageView iv = (ImageView) convertView;
        iv.setImageResource(mThumbIds[position]);
        return convertView;
    }

Here is my xml layout:

<Gallery android:id="@+id/gallery"
        android:background="#000000"
        android:layout_width="wrap_content"
        android:layout_height="100dp"
        android:layout_alignParentBottom="true"
    />

Is there any way i can get the images to be next to each other without having to create a new view for every image?

Best Regards.


Try using android:spacing in the layout file, to decrease space between images.

0

精彩评论

暂无评论...
验证码 换一张
取 消