I have a recyclerView with an adapter inflated inside a cardview. Each item in my list has a different size, because of different image sizes. I am facing visibility problem as cards get recycled, in my cardviews as shown:
How can I fix this problem?
[EDIT] My CardView layout: https://drive.google.com/file/d/1zdM5H54CtfxZBxk6x72uYnSbCzxCnT-_/view?usp=sharing
In your <ImageView>
you need to add scaletype
property for it. Add it like below
<ImageView
.......
android:scaleType="CENTER_INSIDE" >
It will change the ratio of your image but full image is visible. fitxy
also visible whole image as well. Choose more suitable one according to your needs
You can see a good example here. https://robots.thoughtbot.com/android-imageview-scaletype-a-visual-guide find out what scale y=type you want and add it.
As Lucifer said:
In your you need to add scaletype property for it
If you don't like center inside you can use CENTER_CROP
or try anyone of the options.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.