A loading Gif And I use Glide to load Gif, And the third bar show to me is not complete, It show white area in third bar which is not be shown.(English is poor, sorry), like thisError Showing Dear all, How can I solve it?
ScaleType="fitXY"
Glide.with(context).load(R.drawable.loading).into(imageView);
1:
use GifImageView
<pl.droidsonroids.gif.GifImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/src_anim"
android:background="#drawable/bg_anim"
/>
Android-Gif-Drawable
Steps to load Gif images from drawable
You need to move your loading Gif image tores/raw folder of your project
(
if your project don't have raw folder in resource directly then simply make one and put your gif in it )
and then you can simply load your gif with just one line of code
Glide.with(this)
.load(R.raw.loading)
.into(new GlideDrawableImageViewTarget(
(ImageView) findViewById(R.id.image)));
Edits:-
White area in Gif image could be becaouse of streatching gif this is how it look like in my device
Alternatively you can look into this open source library for loading animation
https://github.com/81813780/AVLoadingIndicatorView
Related
How can I remove white background around image when loading with glide.. You can find out below code as well as screenshot;
Glide.with(thiscontext).load(R.drawable.badge_green_yellow)
.asGif().crossFade()
.diskCacheStrategy(DiskCacheStrategy.SOURCE).into(holder.ivHourlyIcon);
ScreenShot
Put your GIF into the raw folder (res/raw/badge_green_yellow.gif)
and then load it like this
Glide.with(thiscontext).asGif().load(R.raw.badge_green_yellow).into(holder.ivHourlyIcon);
I'm trying to load an image from filesystem into an imageView with the ion library.
When I'm using the following code:
Ion.with(imageView)
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.load(uri);
it (sometimes) results in a kind of blurry image.
When not using ion like the following the pictures appear sharply:
imageView.setImageBitmap(BitmapFactory.decodeFile(uri.toString()));
Is there a standard compression coming with ion that I can disable?
Strangely not every picture is blurry when using ion, e.g. I have two identical images, only with another name. When I load them into the imageView with ion one is blurry, one is not.
Any help or tips are appreciated!
Ion tries to load the image to fit the bounds of the ImageView. So make sure your ImageView is sized properly in your layout. Alternatively, if you use adjustViewBounds=true to indicate the ImageView is adjusted by the image contents, it won't do that. Or alternatively smartsize(false).
Try this,
Ion.with(context)
.load(url)
.withBitmap()
.placeholder(R.drawable.placeholder_image)
.error(R.drawable.error_image)
.intoImageView(imageView);
i want to play gif use web view,default webview background is white.so i use :
webView.setBackgroundColor(Color.TRANSPARENT);
but when i use the above code,my gif can play,but behind of my gif it also draw one pic of gif
as:
In the pic you will see a redundant pic at the behind. My original gif pic is like this:
When I was trying to delete webView.setBackgroundColor(Color.TRANSPARENT), the gif was showing good, but background was white.
When i add the code, my gif always have a a redundant pic of the gif.
So my question is: how can I set my gif background as transparent but not mess up the gif?
I have been trying to use a .gif file from my resources, but I get no movement when it loads. I am using it as a loading image while I am doing an asynchronous task. I was previously using a progress dialog but now I would like to display the image myself and not use a dialog. How can I get this image to display correctly?
Try using AnimationDrawable:
http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html
Basically, you should split each of the frames in your gif into separate files - such as .png file (say if it had transparency) and specify these files in the <animation-list> instead. You can also control the duration of each frame.
See the link for code example
If you are deadset on using a gif image you can just use a WebView instead of an ImageView. Then make an html doc that displays your gif image. When you show it in the WebView it will be animated for you.
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()