nizam.sp
nizam.sp

Reputation: 4062

Transparent Image appears black on a Cached Bitmap

I have imported the android's example project in the following link. http://developer.android.com/training/displaying-bitmaps/index.html

When i ran this app, I got a clean grid of images.

When i used a transparent image instead of the given ones, the transparent areas are filled with black color.

See the image. transparent areas around the instagram image became black.

I couldn't remove this black color no matter whatever i change. I tried changing the grid view's background also. It didn't help.

To reproduce the problem, load the project given in the above link and change the first six items in imgUrls in Images.java with https://lh3.ggpht.com/vFpQP39LB60dli3n-rJnVvTM07dsvIzxrCL5xMiy1V4GV4unC1ifXkUExQ4N-DBCKwI=w124

Eg: public final static String[] imageUrls = new String[] { "https://lh3.ggpht.com/vFpQP39LB60dli3n-rJnVvTM07dsvIzxrCL5xMiy1V4GV4unC1ifXkUExQ4N-DBCKwI=w124",

Upvotes: 3

Views: 1664

Answers (1)

Hardikgiri Goswami
Hardikgiri Goswami

Reputation: 116

There are 3 possibilities

  1. Background Color of your layout is black that's why transparent area filled by black..
  2. if you change the background color of layout then area color will be changed...
  3. be sure your transparent file must be .png file
  4. Check Also that the ImageCache uses PNG compression. The default is JPG.

Upvotes: 10

Related Questions