I have a RecyclerView
with a horizontal layout. The height of the individual adapter items can depend on the content of the item.
So in theory it can lo
Try this. Anyway, did you solve your problem?
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
final int newHeight = recyclerView.getMeasuredHeight();
if (0 != newHeight && minHeight < newHeight) {
// keep track the height and prevent recycler view optimizing by resizing
minHeight = newHeight;
recyclerView.setMinimumHeight(minHeight);
}
}
});
Since this question is getting quite a lot of traction and I only posted my personal solution in the comments I'll submit an answer as well.
--
I decided to use Google's Flexbox layout library to achieve what I wanted. It's very customizable and I would recommend it to people who are trying to solve similar problems.
change your imageview height as wrap_content. I'm not sure, try like that.