epoxy icon indicating copy to clipboard operation
epoxy copied to clipboard

RecyclerView's wrap_content constrained height not updating

Open timozander opened this issue 5 years ago • 3 comments
trafficstars

Hello everyone,

using Epoxy I stumbled upon a problem which I narrowed down to being a possible problem at the library's end.

I am using a RecyclerView which height="wrap_content". So, I expect the height to recalculate whenever the data changes. Unfortunately, this does not happen. When I click on one of the items, I re-set the data and all the diffing works properly. Nonetheless, the height is not re-calculated (onMeasure() of the RecyclerView is not called at all).

Screenshot_3

When I manually force the RecyclerView to update its height (e.g. by opening the keyboard), the height recalculates. Recreating this scenario with a default adapter and viewholder works properly.

Any ideas on how I could fix this?

timozander avatar Dec 01 '19 08:12 timozander

Are you using hasFixedSize in the RecyclerView? That sounds like the behavior you are seeing

elihart avatar Dec 01 '19 16:12 elihart

No, I explicitly set hasFixedSize to false via databinding

timozander avatar Dec 01 '19 17:12 timozander

Is there any update on this, I've the same issue in which some of the views will be hidden based on logic, and the recycler view is not recalculated and is shown an extra bottom space.

kukadiajayesh avatar Jan 19 '24 20:01 kukadiajayesh