0

Is there any way to scroll a ScrollView programmatically to a certain position?

I have created a RelativeLayout and it has a ScrollView and a child LinearLayout inside ScrollView. I used this code for Scrolling down. but it Scroll very less

        sv0.post(new Runnable() { 
        public void run() { 

            //sv0.fullScroll(View.FOCUS_DOWN);
            sv0.scrollTo(1000, 1000);
        } 
});

Is there any way to scroll to specific location programmatically?

androidboy
  • 15
  • 1
  • 7
  • 2
    Welcome to stack overflow! When typing in a question a list of possible questions already asked appears, be sure to look at them. – weston May 02 '15 at 07:19
  • In that duplicate, the best answer is possibly not the accepted one, be sure to scroll to http://stackoverflow.com/a/8684666/360211 – weston May 02 '15 at 07:23
  • thank you. but i seen this before. and this question does not explain how to scroll to specific position. – androidboy May 02 '15 at 07:27
  • @weston: i used this code sv0.post(new Runnable() { public void run() { //sv0.fullScroll(View.FOCUS_DOWN); sv0.scrollTo(1000, 1000); } }); but it just scroll down very less. – androidboy May 02 '15 at 07:33
  • You should put what you have tried in the question when you ask it. It saves people suggesting stuff you have tried/duplicates and shows effort on your part. Edit the question to put the code in. Code looks horrible in comments. – weston May 02 '15 at 07:37
  • http://stackoverflow.com/questions/7561353/programmatically-scroll-to-a-specific-position-in-an-android-listview – Sushant May 02 '15 at 12:33
  • I solved this myself. you can use final ScrollView sv0=(ScrollView)findViewById(R.id.Scrollbar1); sv0.post(new Runnable() { public void run() { sv0.smoothScrollBy(0, 12200); } }); to go to down in layout:) – androidboy May 03 '15 at 07:32

0 Answers0