0

I'm new to Android Java programming. For a project I need transparent images, which change dynamically. I have created a layout with an ImageView. And in it a small GIF USA flag GIF with a transparent background.

enter image description here

In code I connect the variable to the imageview and assign the same image to the variable from the ImageResources

ImageView image = (ImageView)convertView.findViewById(R.id.listview_image);
image.setImageResource(R.drawable.vlag);

This goes pretty well however the image is displayed with a white background. The transparency is lost. This is shown in the image below by the white background.

enter image description here

Vincent
  • 4,342
  • 1
  • 38
  • 37

1 Answers1

0

GIF over ImageView are always an issue. Use GIFImageView

And you must use it this way:

 gifImageView = (GifImageView) findViewById(R.id.gifImageView);
 gifImageView.setBytes(bytes);
 gifImageView.startAnimation();

Even it has an option to download the gif from the web.

Mariano Zorrilla
  • 7,165
  • 2
  • 34
  • 52