1

I have a layout in which i have two button:

1)back
2)help

and ScollView in which i place two image Views:

1) firstImageVeiw
1) SecondImageVeiw

first image View will be displayed on front and second is placed beneath the 1st image. Now i want that if i click on help button the the scrollView automatically slides to 2nd image view.

Any help or suggestion.

GrIsHu
  • 29,068
  • 10
  • 64
  • 102
User42590
  • 2,473
  • 12
  • 44
  • 85

1 Answers1

2

You can use scrollview's scrollTo() method

helpbutton.setOnClickListener(new OnClickListener() {
   @Override
   public void onClick(View v) {
     yourscrollview.scrollTo(0, yourImageView.getTop());
   }
  });

At runtime you can get the location of every view object with

Renjith
  • 5,783
  • 9
  • 31
  • 42
  • ok how can i get the whole area of ScrollView so that i can assume my secondImage is palced on which coordinates?? – User42590 Jan 31 '13 at 11:30
  • @RKN can you see this http://stackoverflow.com/questions/14561693/tab-widget-issue-when-use-androidconfigchanges-orientationkeyboardhidden-in i have some issue about oriention but scroll can help only me some time – Chintan Khetiya Jan 31 '13 at 12:01
  • @RKN thankyou. its working but ites not giving sliding effect. yourscrollview.scrollTo(0, yourImageView.getTop()) directly moves to the imageview . is there any possibility to give sliding effect?? – User42590 Feb 01 '13 at 07:31