I have a problem which is driving me nuts. Basically it is a simple RecyclerView which displays a cardview. There are a lot of posts out there already, which I checked. I have a
Your code is fine, The problem is with layout file: document_item.xml
:
mistake
android:layout_height="wrap_content"
android:layout_weight="0.25" />
mistake
android:gravity="center_horizontal"
android:orientation="vertical"
...
The second LinearLayout
gets its height from parent (first LinearLayout
), and the first one gets its height from its only child: ImageView
(so without no drawable
set, the second layout's height will be zero! ), if you set a drawable
for ImageView
(in onBindViewHolder
method or in layout xml file) it probably crops some of TextView
items, Also when you set android:layout_width
to "wrap_content"
, actually you're ignoring layout_weight
.
So edit layout file like this:
...