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?
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 want to make a small part of the image glow whenever the activity is loaded. Do I need to take the exact coordinates of the image part?
I recommend using a GIF. It can be loaded as an image and won't require any changes in your code. A smallish tutorial can be found in this Youtube video.
I use the following statement to copy an image from the assets to the gallery app, which works fine:
MediaStore.Images.Media.insertImage(getContentResolver(), myBitmap, myTitle , myDescription);
The images are png-files with a transparent background. They are displayed correctly when I load them from the assets to, for example an ImageView.
The problem is, that the formerly transparent background of the imported images became solid black in the gallery.
The png is a png24 created by gimp. I also tried a transparent gif and a png with transparency added by Apple's preview application with the same result.
Why it happens?
I know this is an old question but I just had the same problem. The problem is that MediaStore.Images.Media.insertImage stores the file with a MIME_TYPE of "image/jpeg", and jpeg doesn't support transparency.
One solution is to make your own content provider that uses another image format. The Picasso image library might be worth a look too.
I am using an Image Loaded which loads images based on requirment and since the images are big. I want to display an intermediate Spinning Image showing which would convey that the image is loading to the User.
I am displaying these images in the Viewpager.
We can not use a Gif image to display the animation and i wonder how it can be done.
P.S i am not looking for a Progress Dialog.
You could try doing a View Animation on the ImageView. Rotate is one of the included animations, and you can define it in XML.
Here's a Youtube Video from Google explaining it a little more.
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.