How to scroll to top of long ScrollView layout?

前端 未结 15 784
轻奢々
轻奢々 2020-11-30 18:34

For part of my app, the user is presented with a list of names and is asked to group them as they see fit.

(Note, the ListView code was copied verbatim from the And

相关标签:
15条回答
  • 2020-11-30 18:56

    This solution also works for NestedScrollView

    NestedScrollView nestedScrollView = view.findViewById(R.id.YourNestedScrollViewID);
    nestedScrollView.fullScroll(ScrollView.FOCUS_UP);
    
    0 讨论(0)
  • 2020-11-30 19:00

    I faced Same Problem When i am using Scrollview inside View Flipper or Dialog that case scrollViewObject.fullScroll(ScrollView.FOCUS_UP) returns false so that case scrollViewObject.smoothScrollTo(0, 0) is Worked for me

    Scroll Focus Top

    0 讨论(0)
  • 2020-11-30 19:01

    i had the same problem and this fixed it. Hope it helps you.

    listView.setFocusable(false);
    
    0 讨论(0)
提交回复
热议问题