user1302569
user1302569

Reputation: 7191

Gallery and fading edges

I have a gallery where I have a bitmaps. This is code:

    // Bitmap snoop = BitmapFactory.decodeResource(mContext.getResources(), mImageIds[position]);
   // i.setImageResource(mImageIds[position]);
   // i.setScaleType(ImageView.ScaleType.FIT_XY);
        BitmapFactory.Options options = new BitmapFactory.Options();

        // will results in a much smaller image than the original
        Bitmap b = BitmapFactory.decodeFile("/sdcard/DinEgen/"+name.get(position), options);
        Bitmap img = Bitmap.createScaledBitmap( b, width, height, true );
         b.recycle();
    i.setImageBitmap(img);
    //i.setBackgroundResource(mGalleryItemBackground);
    i.setGallery(g);
    i.setLayoutParams(new Gallery.LayoutParams(width, height));

    return i;

When I start application everything looks ok. Like on the picture: enter image description here

and when I go to next page everything looks bad: enter image description here

Color is lighter and on left side is something like edge with good color. When I back color is lighter too and this edge is on right side. I used in gallery

android:fadingEdge="none" android:fadingEdgeLength="0px"

but still doesn't work. Any idea why color is changing and why when I go to next page I see this edge? Any ideas why this is happens?

Edit1: I resolve one problem with margins. I add 30 to width in: i.setLayoutParams(new Gallery.LayoutParams(width+30, height)) but still colors are lighter after go to next page. Any idea why?

Upvotes: 3

Views: 888

Answers (1)

Eddy K
Eddy K

Reputation: 874

try the following to stop image overlapping and thus eliminating your problem :

Gallery gallery= (Gallery)findViewById(R.id.gallery);
gallery.setHorizontalFadingEdgeEnabled(false);

Upvotes: 3

Related Questions