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.
Related
I have an app that loads content from a database as well as images from the internet. I am using a RecyclerView along with CardView to display my content in a list form.
Each row has an image on the left side and text on the right.
The problem is that the text loads fast but the image takes time to load, so I want the image to continue loading in the background and then load into the ImageView object once loading is complete. I have no idea how to tackle this.
I use Picasso for this situation, but u can also use Glide and many more libraries. The documentation is pretty simple.
Try Picasso:http://square.github.io/picasso/
It's a one liner in onBindViewholder():
Picasso.with(context).load(url).into(viewHolder.imageView);
I am currently doing a project which needs to load images in a listView with some text from web.I am using universal image loader library,every thing work fine images are loading perfectly without any problem, but my requirement is that if there is no image in a specfic url, i dont want to show that image view in the listview row.which is similer to the news stand app of google.
in the above screen of the newsstand app if there is no image the imageview is not shown and the text will fill to the total width of the cell or row in the listview.How can i achieve this requirement.i have goggled but did not get any right solution or clue to fix this issue,can any one give any snippet or any idea to sort out this issue.
Thank you
In your adapter, when you call the library to display the image, if there is no image url just set the visibility of your ImageView to GONE (and VISIBLE again when there is an url).
If you want to wait that the image is completely loaded to make the ImageView visible, you'll need to register a loading listener. See here.
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 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.
First Question
I use Lazy load of images in ListView to load images in a ListView and a GridView. It works but the images are loaded form bpttom to top. How to fix that?
Bonus Question
Can I use a loading animation in a image view while the real image is loaded? Right now it's just a default image.
In ImageLoader.java you could replace
photoToLoad=photosQueue.photosToLoad.pop();
with
photoToLoad=photosQueue.photosToLoad.get(0);
photosQueue.photosToLoad.remove(photoToLoad);
It will change the order.
To display ProgressBar you can just add it to item.xml. Initially ProgressBar is visible and image is hidden. After bitmap is downloaded you hide ProgressBar and show image. But I would not recommend doing that. While images are being decoded in the background they consume processor power and all your progress bars may be freezing sometimes.