RecyclerView content height

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.


RecyclerView is a ViewGroup. You can use getChildAt / getChildCount to get views. Then from the view, you can call getWidth / getHeight.

If you have ItemDecorators and need to get size including them, you can use LayoutManager's getDecorated<xxx> methods.


I use to experiment with View.measure method:

recycler.measure(View.MeasureSpec.makeMeasureSpec(recycler.width, View.MeasureSpec.EXACTLY), View.MeasureSpec.UNSPECIFIED)
val height = recycler.measuredHeight

If your items are simple enough (e.g. with fixed heights), it should work.