NestedScrollView + CoodinatorLayout scrollBy() scrollTo() methods do nothing

后端 未结 2 553
甜味超标
甜味超标 2020-12-21 05:53

I have a NestedScrollView being used with CoordinatorLayout + AppBarLayout + CollapsingToolbarLayout with parallax effect similar to this tutorial

I need to scroll t

2条回答
  •  旧时难觅i
    2020-12-21 06:31

    Scrolls (scrollBy()/scrollTo()/smoothScrollTo()/smoothScrollBy()) needs to be called from UI thread.

    In Kotlin, you can use

    Handler().post {
        nsv_form.scrollBy(0, 300)
    }
    

提交回复
热议问题