I am making a horizontal RecyclerView with photos in it, and I ran into the wrap_parent problem. If I embed my View width = wrap_content , this is the width of the screen width, although the image consumes very little space. If I change the wrap_content value to some value, it works fine. The recycle image has a height of 75dp and match_parent .
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="75dp" android:layout_height="wrap_content" android:clickable="true" android:foreground="@drawable/card_foreground"> <ImageView android:id="@+id/bitmap" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentDescription="@string/image" /> </LinearLayout>
Screenshot
Blue is the screen, and light blue is the photograph. The problem is that I have case 1 when I set the view to wrap_content .
DECISION:
I recently solved this problem, is there some kind of error or something similar when you are trying to use the scalable ImageView wrap_parent. This does not work very well. To solve this problem, I resized each photo to its final size before placing it in RecyclerView. In the end, I again have a small space between ImageView, and I decided by adding padding=0 and margin=0 to the childern RecyclerView.
source share