I am using the AppIntro https://github.com/apl-devs/AppIntro
library with the default slides builder.
It works great but I am having trouble passing gifs as the drawable for the default builder.
addSlide(AppIntroFragment.newInstance(title, description, image, backgroundColor));
I read that android has issues displaying gif by default and I have to use GifImageLoader or Glide to load the gif.
Glide
.with(context)
.load("imageUrl")
.asGif()
.placeholder(R.drawable.gifImage)
.crossFade()
.into(imageView)
I could try this but I don't have an imageView where I can pass into the argument if I use the default builder.
I also tried GifDrawable gifFromResource = new GifDrawable( getResources(), R.drawable.anim ); from Display Animated GIF but it gives an error.
My next closest option is to create a custom fragment to use with AppIntro and I really don't want to do that.
Is there any way to pass the gif into the default slide builder and have it play?
You can use Simple Target from Glide library. Override onResourceReady() and load this as image in new slide. Please note I have not tried this with gif and have not access to my dev machine now.
Simple Target docs
Related
I'm using this library (Xamarin binding library of Glide), to display Gif in my app. But i would like to display Webp animations to save some space in my app.
Glide.With(context)
.Load(url)
.Into(imageView);
But the animation is locked on the first frame and didn't played (webp animation example).
Did i miss something?
Thank you.
Regards, Samih
It's a known issue.
Right now, Glide has no built-in webp support and defaults to the system.It seems like Glide will work when you introduce some libraries that support WebP.
I want to use a video placeholder before the actual images loads up. I am using a Fullscreen ImageView to load the image but till the time image is loaded to the imageview, i want to show a placeholder video at that place. I am not sure, even if it is feasible or not. If in any case it is feasible, would be looking for the way to get out of this.
Finally got this working, i was able to use GIF animation as my Placeholder using Glide.
Loaded GIF file from drawable resource.
RequestOptions requestOptions = new RequestOptions();
requestOptions.placeholder(R.drawable.placeholder);
Glide.with(context)
.setDefaultRequestOptions(requestOptions)
.load(articlesListChild.get(position).getArticleImage())
.thumbnail(Glide.with(context).load(R.drawable.logo_anim_full)) // This line did the magic
.into(imageContentIv);
I am new in android app developing and got stuck in this problem. To understand my problem -
Let, I am a developer and I have an app. The app has a imageview. In that imageview, the image will be loaded using glide load(url) method from my(developer) website. Now I(developer) want to change the image that will be shown in the app same imageview. But if I change the image the image url will be changed and glide load(url) method will not be able to download new image? How can I solve this problem or what topic should learn to handle this issue or what is the alternative?
Download image
Save to disk (optional)
Modify image (optional)
Show modified image in ImageView.
(You don't need glide here)
I am using glide in my project for the purpose of loading images from the url. But I have another requirement to load GIF image background for my view from drawable folder using glide. I am completely stuck up with the methodology and solutions for loading GIF into my view. I have been struggling with for a couple of days. Kindly please help me with youor solutions to perform loading GIF from drawable using Glid 3.6.0. Thanks in advance. I am posting the piece of code that I am using in my project as follows,
Glide.with(LoginActivity.this)
.load(getResources ().getDrawable (R.drawable.bg_gif));
.placeholder(R.drawable.login_bg)
.crossFade()
.into(relativeLayout);
Note : I have tried using .asGif() method to load, but unfortunately it is indicating the error cannot resolve method asGif()
it may be late now but I load my gif from resources this way:
Glide.with(fragment).load(id).asGif().placeholder(R.mipmap.ic_launcher).into(img);
id is an (int) with the resource file, example:
R.drawable.YOURGIFNAME.gif
In my case I call glide giving a FragmentActivity, but glide can be called different way check docs https://github.com/bumptech/glide
I found out that the gif wont load if you dont add the:
.placeholder(R.mipmap.ic_launcher)
Hope it helps.
Use the following snippet:-
GlideDrawableImageViewTarget imageViewTarget = new
GlideDrawableImageViewTarget(imageView);
Glide.with(this).load(getResources ().getDrawable (R.drawable.bg_gif)).
into(relativeLayout);
I need some advice about animation. I have an animated GIF, but how to put in Android app to be animation. When I put it doesn't move at all. I read something about animation in Android and I need to have pictures for animation. Is there any solution for this ?
Android does not support animated GIFs much. You can use an AnimationDrawable, perhaps defined from frames using a drawable XML file.
you can do it by using GIF image in your app as Splash screen.
Android does not support animated GIFs. so extract gif to png pictures with gif2png and it works with XML.
And Other Option Adding gif image in an ImageView in android
Adding gif image in an ImageView in android
100 % Work...
1) Add Glide library dependency...
compile 'com.github.bumptech.glide:glide:4.2.0'
2)
imageView = findViewById(R.id.gifImage);
3)
Glide.with(getApplicationContext())
.asGif()
.load(R.drawable.gifImage)
.into(imageView);
just use .asGif() before .load()