Horizontal Recyclerview

Hy,
I’m try trying to create nested horizontal Recyclerview s inside a vertical recyclerview.
The height of the itemview in the horizontal rv is dynamic.
How can i force the rv to bind all the items at once in order to detect the largest height?
I don’t want to my RV to change its height at runtime.

My list has fixed size
.
ListView doesn’t not support horizontal scrolling!
Is there any way to treat RV as ListView?
Thank you

How can i force the rv to bind all the items at once in order to detect the largest height?

You can’t, AFAIK.

Instead, you could use a HorizontalScrollView wrapped around a horizontal LinearLayout (or equivalent ConstraintLayout), so all of your items are available at the outset. Then, a simple wrap_content height for the LinearLayout and HorizontalScrollView will give you the height that you want.

ListView doesn’t not support horizontal scrolling!

Correct. Other than Spinner, I do not recommend that anyone use AdapterView subclasses for modern Android app development. Everything else that I can think of can be handled by something based on RecyclerView.

Is there any way to treat RV as ListView?

Sorry, but I do not know what you mean by this.

Thanks for the quick reply
I solved the issue using your recommendation
(HorizontalScrollView)

Appreciate it!

1 Like