0

I am new to Android Programming. I am using the scroll view for rendering a view.

My XML view as follows:

<ScrollView>

<LL1> <TV1> </LL1>
<LL2> <TV2> </LL2>
<LL3> <TV3> </LL3>
<LL4> <TV4> </LL4>
<LL5> <TV5> </LL5>
<LL6> <TV6> </LL6>

</ScrollView>

When I click on TV6 then LL6 layout should move to the top of the screen.

I tried following things but not working properly:

 - TV6.getParent().requestChildFocus(TV6,TV6);
 - scrollView.smoothScrollTo(0, 0);

Let me know how to achieve this.

Thankless
  • 129
  • 2
  • 8

1 Answers1

0

Try this one, maybe this will work for you

scrollView.post(new Runnable() { 
        public void run() { 
             scrollView.fullScroll(scrollView.FOCUS_DOWN);
        } });

or

scrollView.post(new Runnable() { 
    public void run() { 
         scrollView.scrollTo(0, scrollView.getBottom());
    } });
Mahesh Keshvala
  • 1,349
  • 12
  • 19