Reputation:
How to add multiple GIFs to Android GridView? Let's assume that we have a 4*4 grid (16 cells), with a different individual animated GIF image being shown in each cell in such a way that each image is animating on its own. Therefore creating a GIF of 16 different videos/animations, all playing at the same time in 16 separate cells.
Upvotes: 1
Views: 570
Reputation: 187
In you GridAdapter make a function
public void upadteList(List<yourGifList> list){
this.gifList = list;
notifyDataSetChanged();
}
then in OnBind Method
call
Glide.with(context).asGif().load(gifList).into(imageView);
In your activity call upadteList() method
gridAdapter.updateList(imagesList);
Note : i am assuming you are already have a recyclerView setup.
Upvotes: 1
Reputation: 1835
You can use recyclerview or gridview. Then use Glide library in your adapter
ImageView imageView = (ImageView) findViewById(R.id.imageView);
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(imageView);
Glide.with(context).load(yourGif).into(imageViewTarget);
or
ImageView imageView = (ImageView) findViewById(R.id.imageView);
Glide.with(context).asGif().load(yourGif).into(imageView);
Upvotes: 1