Programmatically scroll to the top of a NestedScrollView

后端 未结 13 1646
情书的邮戳
情书的邮戳 2020-12-13 12:02

Is there a way to programmatically scroll to the top of a NestedScrollView by also triggering the scroll events for the parent? smoothScrollTo(x, y)

13条回答
  •  佛祖请我去吃肉
    2020-12-13 12:34

    I tried all the above responses, nothin seemed to work but I only needed a postDelayed.

        scrollview.postDelayed(new Runnable() {
            @Override
            public void run() {
                listener.setAppBarExpanded(false, true); //appbar.setExpanded(expanded, animated);
                scrollview.fullScroll(View.FOCUS_DOWN);
            }
        }, 400);
    

提交回复
热议问题