问题
I have custom recyclerview with view Holder. I have one searchview. I want to move recycler view position as per searchview searched text. How can I achieve this task? so that search text filter will perform and according to filteration I will get position of filtered text. and using that I can move my focus (scroll) to that position.
Thank you
回答1:
Try this:
myRecyclerview.scrollToPosition(position);
if not works in some cases(Keyboard opening etc.), try using delay.
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
myRecyclerview.scrollToPosition(position);
}
}, 200);
来源:https://stackoverflow.com/questions/43829419/recycler-view-scroll-to-specific-position