I've seen other answers to this question but none worked for me; for example the top answer here (How to get the height of recyclerview item in "onBindViewHolder") says to do this:
view.measure(
View.MeasureSpec.makeMeasureSpec(recyclerViewWidth, View.MeasureSpec.EXACTLY),
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
but then doing view.getMeasuredHeight()
only returns whatever I pass in for recyclerViewWidth
.
Basically I want to set the size of components within the recycler view cell as fractions of the cell's size, but those fractions depend on the position of the cell. I'm a bit frustrated since this is so simple to do in iOS and seems so much more convoluted in android.