Remove transparent white background from gif image using glide? - android

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);

Related

I can't make an image transparent on Android?

I tried everything, but it didn't work. Please help me
All you have to do it to download a transparent img of a cart and adjust the width and length you can also download it with the link below 👇👇
https://www.flaticon.com/free-icon/shopping-cart_833314?term=cart&page=1&position=3&page=1&position=3&related_id=833314&origin=search
If you have taken this image from your storage then you can simply convert it's background transparent by using any background remover tool online such as this one:
remove background

Glide Load Image Not Complte

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

Black background when downloading png image in android

i stuck in very serious problem.when i am downloading png image from server than, i can get black background in the image. how can i remove this black background from an image at the time of downloading?
Thanks in advance.
Image change extension .png while you download image then change background color pixel by pixel cut on image and return new bitmap
Do you save your image on the device using PNG format too ?

downloaded png image with transparent background shows with black background

In my android application I downloaded some png image and write them in sd card. when I show them in image view they are showing with black background. the original images have transparent background. How I can keep the background transparent. Please help me. I use PNG format to compress and write it to sd card
Set The View Background as
R.color.transparent
or in xml like
android:background="#android:color/transparent"
Edited :
Thanks for reply. yes I did this. I did just now One more thing, I set canvas color android.R.color.transparent and it worked

webview setBackgroundColor when play gif image

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?

Categories

Resources