2

I know how to get to the bottom of a RecyclerView with the following line

mLayoutManager.scrollToPosition(contentListToDisplay.size()-1); 

But I've a requirement to not just go so that row is visible, but so the it's entire content is shown on the screen (or if it's really long so that the top is shown and the rest of the screen is filled with it's content)

I've tried passing in the offset value (so far I've just tried a few hard coded values to experiment) but it doesn't seem to move further down the row.

What's needed to make it ensure the whole row (where possible) is shown on the screen and not just a small section of the top of the row?

1 Answer 1

1

try this :

 RecycleViewObject.postDelayed(new Runnable() { @Override public void run() { RecycleViewObject.scrollToPosition(RecycleViewObject.getAdapter().getItemCount()); LayoutManager.scrollToPosition(RecycleViewObject.getAdapter().getItemCount()); } }, 10); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.