ScrollView scrollTo doesn't work

前端 未结 4 911
日久生厌
日久生厌 2021-01-02 19:41

Same issue as ScrollView .scrollTo not working? Saving ScrollView position on rotation

I dynamically add items to scrollView in onCreate. I try the following after a

4条回答
  •  [愿得一人]
    2021-01-02 20:11

    This works for me, replace scrollView.scrollTo() to

         scrollView.post(new Runnable() {
            @Override
            public void run() {
                scrollView.scrollTo(0, ScrollViewYPosition);//0 is x position
            }
        });
    

    I was helped by Vasily Kabunov 's answer in

    ScrollView .scrollTo not working? Saving ScrollView position on rotation

提交回复
热议问题