yann.debonnel
yann.debonnel

Reputation: 766

Gallery items overlapping (bleed in)

My probel is that images in my Gallery are bleeding in into each other once I begin scrolling towards the next image.

I am using a android.widget.Gallery connected to a custom adapter I extended from BaseAdapter.

The adapter's GetView() method is like this

public View getView(int position, View convertView, ViewGroup parent) {
            ImageView i = new ImageView(mContext);
            if (mImageBitmap != null && position < mImageBitmap.length)
             i.setImageBitmap(mImageBitmap[position]);
            return i;

alt text }

Upvotes: 12

Views: 6553

Answers (4)

Jonathon Horsman
Jonathon Horsman

Reputation: 2333

It seems the fading is added automatically and disabling through XML doesn't work.

However disabling programatically seems to work:

Gallery carousel = (Gallery)findViewById(R.id.image_carousel); carousel.setHorizontalFadingEdgeEnabled(false);

Upvotes: 3

Yuntao
Yuntao

Reputation: 665

If you have access to the Gallery instance, you can also call the following method to remove the bleed in area:

gallery.setUnselectedAlpha(1.0f);

This also removes the white-ish haziness of the Gallery view.

Upvotes: 0

yann.debonnel
yann.debonnel

Reputation: 766

I actually found the solution to my problem. In getView(), the ImageView I was returning had no background and thus the ImageViews would overlap. I set the background of the ImageView to black before returning it and it looks great

Upvotes: 9

level32
level32

Reputation: 555

Did you try using android:spacing ( in xml) or setSpacing(int spacing) (in code) on the Gallery?

Upvotes: 29

Related Questions