NestedScrollView's fullScroll(View.FOCUS_UP) not working properly

后端 未结 4 1684
面向向阳花
面向向阳花 2020-12-10 05:12

I have a NestedScrollView populated with a vertical LinearLayout, which itself has a bunch of children of various view types: multiple TextViews, two static GridViews, and e

4条回答
  •  既然无缘
    2020-12-10 06:00

    try this

    add android:descendantFocusability="blocksDescendants" to the LinearLayout inside NestedScrollView and this also

    to scroll to top of NestedScrollView use this

    NestedScrollView.scrollTo(0, 0);
    

    Edit

    Use fling() and smoothScrollTo togather

    nestedScrollView.post(new Runnable() {
       @Override
       public void run() {
          nestedScrollView.fling(0);
          nestedScrollView.smoothScrollTo(0, 0);
       }
    });
    

提交回复
热议问题