Android: How to scroll ScrollView in top

后端 未结 5 1430
小鲜肉
小鲜肉 2020-12-14 17:05

I have two buttons that switching to the next list of events and the previous one.

When I go to next\\previous event, scrolls remains somewhere below. But I need to

5条回答
  •  攒了一身酷
    2020-12-14 17:33

    I know this is an old post but there is a reason the code will work some places and not others. It will get interrupted by the main thread if called in the wrong place, especially if the ScrollView must scroll a large distance. Therefore put your call in its own thread. Fixed.

    (new Thread(new Runnable(){
       public void run(){
          mScrollView.fullScroll(View.FOCUS_UP);
       }
    })).start();
    

提交回复
热议问题