Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RecyclerView content height

Tags:

Is there any good way of getting the height of the content inside RecyclerView? Considering all items may have different height.

In my scenario I'm using a LinearLayoutManager.

I've searched around and found surprisingly few results for this problem.

like image 446
Kenneth Avatar asked Feb 07 '15 21:02

Kenneth


1 Answers

RecyclerView.computeVerticalScrollRange will give an estimation - it averages the height of the rows being currently displayed and multiplies that by the result of getItemCount

computeHorizontalScrollRange for width if you're orientation is horizontal.

like image 73
mdd-sbo Avatar answered Sep 19 '22 13:09

mdd-sbo