I have a horizontal oriented RecyclerView inside ConstraintLayout as its direct child. Recycler matches parent's widht, and sets its height accordingly to item's view height. The problem - Recycler can't increase or decrease its height depending on item's view height.
For example, 3 visible items on start of screen has similar 100dp height. Next, i scroll - and see 200 dp height item. It will partialy fir 100dp window and user won't see all content.
Does anyone face wiht this problem?
Maybe you should set measurement cache disable with your LinearLayoutManager and request layout after scrolled.
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
layoutManager.setMeasurementCacheEnabled(false);
YourRecyclerView.setLayoutManager(layoutManager);
YourRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
layoutManager.requestLayout();
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With