I am using Picasso to show images from url. My issue is , when I used debug APK, all images in list and grid view show perfect, whenever I upload APK to play store and install Live app, some of image stretch height wise. I did not give width and height in layout. I am not able to figure out the issue. Please help.
Debug App
Live app
Screenshot from both app is added.
Try this Glide This is perfect for Url Image.
Add this library to your gradle file
implementation 'com.github.bumptech.glide:glide:4.11.0'
Glide.with(OurAppsActivity.this)
.load(image_url)
.into(your_ImageView);
Perhaps what you need is making images have fixed aspect ratio on all phones.
Customize ImageView: https://github.com/santalu/aspect-ratio-imageview/
Use ConstraintLayout: ConstraintLayout aspect ratio
Related
In my android application, we are using Picasso plugin to display the file in to the imageview. Please refer the below code.
val pf= File(photo!!.thumbnailPath)
Picasso.get()
.load(pf)
.into(imageView)
I am using latest Picasso plugin and in this code, if we select landscape image from gallery then the image will display fine on the ImageView. But if we select the portrait images then it will automatically change the orientation while displaying it on ImageView.
I knew this is the known bug in Picasso plugin and I tried lot of other possibilities and couldn't able to fix it. Can anybody have any idea about how to display all images in proper way in the ImageView without any orientation.
In above diagram car image as landscape and flower image as portrait mode. I need to fix that flower image (portrait mode) should display properly as it is in gallery.
Thanks
AK
I have recently started to learn android application development. Now I have some troubles in the image insertion. When i use the default images (launcher_background) my application seems to work fine. But any time I try to insert a HD image the application seems to stop. This has been going on for quite a while now.
Mybe it's because your image size is too big if your image is too big you should change image width and height to size of the image view or device display
There are thred party libaries you can use like :
https://github.com/Piasy/BigImageViewer
For more information see the links below :
https://developer.android.com/topic/performance/graphics/load-bitmap.html
https://android.jlelse.eu/loading-large-bitmaps-efficiently-in-android-66826cd4ad53
I am working on an application which uses Google Firebase and RecyclerView. While retrieving the images from Firebease, images are not properly scaling up. When scrolling the recyclerview, sometimes images are showing as smaller ones and sometimes bigger. They are not scalling properly. I am using Glide to load the images. Please help me .
Also, is it a good idea to use Recuyclerview to use in complex application since OnbindViewHolder being called multiple times causing performance issues. Is there any alternative for that.
Please use this code:
Glide.with(profilePhotoImageView.getContext())
.load(profilePhotoUrl).centerCrop()
.transform(new CircleTransform(profilePhotoImageView.getContext()))
.override(40,40)
.into(profilePhotoImageView);
This means that you are setting a fixed width and height. In which profilePhotoUrl is the url of your image and profilePhotoImageView is the ImageView in which you want to display the image.
And don't forget to add the latest version of Glide in your build.gradle file.
'com.github.bumptech.glide:glide:4.0.0-RC1'
Hope it helps.
I am looking for Google Photos app style image manipulation. I am kind of new to image processing. Any leads on how to make the cropping rectangle with the image the same size as cropping rectangle, rotation (which rotates both the image and cropping rectangle), image straightening (including how to get that angle slider kind of UI) will be great. If there are some libraries that has these features, that will also work.
Square has a library for loading and playing with images.
Here are some features:
- Handling ImageView recycling and download cancelation in an adapter.
- Complex image transformations with minimal memory use.
- Automatic memory and disk caching.
There is detailed information on how to use the lib on their website. Check it out: Picasso
The gradle line you need to add is:
compile 'com.squareup.picasso:picasso:2.5.2'
It's very easy to use. Here is how I load and adjust an image into an ImageView in my example app:
Picasso.with(mContext).load("http://cdn0.vox-cdn.com/uploads/chorus_asset/file/798874/DSCF1913.0.jpg").fit().centerCrop().into(imageView);
As you can see, I've used fit().centerCrop() here. This will adjust the image to fit proportionally inside my imageView. You can try different forms of image transformations to better fit your needs.
You can also load images from your drawable folder or directly from file:
Picasso.with(context).load(R.drawable.landing_screen).into(imageView1);
Picasso.with(context).load("file:///android_asset/DvpvklR.png").into(imageView2);
Picasso.with(context).load(new File(...)).into(imageView3);
EDIT:
Looks like I didn't fully understand your question when I first read it. Here are some tips for what you're trying to achieve. May not be exactly what you want, but I think it might be a start.
If you want to rotate your image, you can do it with Picasso using RequestCreator.rotate(float degrees).
Here's the documentation for RequestCreator.
As for cropping images (inside a specified rectangle, as you've shown), there is:
Android crop.
Or you can use Picasso Transformations and create a transformation like
CropTransformation(Top, Center, Bottom);
And ask Picasso to transform the image like this:
Picasso.with(mContext).load(R.drawable.demo)
.transform(transformation).into((ImageView) findViewById(R.id.image));
Also, as #Amit K Saha said on his answer, you can use some Android SDK effects. Check android.media.effect.
Hope this helps.
There are some help from android sdk. May not be exactly what you are looking but worth of a shot to start. Have a look here.
android.media.effect
And list of available effects can be found here
http://developer.android.com/reference/android/media/effect/EffectFactory.html
I am using the Scrollable ImageView by Egor Andreevich found here.
Although I have successfully managed to insert this into my app, the issue I'm having is that my image is very laggy. The image I'm using is 1.63 mb and 3713x3329 in dimension. If I use a smaller image that is both small in dimension and size, then it works perfectly.
The post you are referring to seems to be an introduction of scrolling images in an ImageView, and not a complete implementation. I would direct you to PhotoView for a more complete implementation.