0

Since my ScrollView is very long, and users need to scroll down for a long time to arrive to the desired TableLayout, I would like to ask whether there are functions in a way that if I design a button such that when it was pressed, it will automatically scroll down itself to the desired TableLayout location?

I do not know what is this named in technical term. Could somebody tell me how to achieve it? Would there be examples of codes? Many thanks in advance!

Nathan Petersen
  • 214
  • 5
  • 16
pearmak
  • 4,979
  • 15
  • 64
  • 122

1 Answers1

0

Refer to Can I scroll a ScrollView programmatically in Android?

In your activity:

Button b = (Button) findViewById(R.id.button1);
b.setONClickListener(new Button.OnCLickListener() {
    public void onClick(View v) {
        myScrollView.scrollTo(0, y_index);
    }
});
Community
  • 1
  • 1