Scenario:
notifyItemRangeInserted at position 0 - this item is "invisible"
by default and in order to see it I have to manually scroll up.How can I get this first item of type B "automatically" visible?
You can use this line of code after notify item of type B:
yourRecyclerView.smoothScrollToPosition(0);
using https://stackoverflow.com/a/54899984/8144663 only wont resolve your issue.
You will need to call smoothScrollToPosition() in the next frame like,
recyclerview.post(new Runnable() {
@Override
public void run() {
recycleview.smoothScrollToPosition(n);
}
});
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