Is there something similar to the HTML anchor link on Android?

1

I'm looking for a way to navigate between a long list of elements (TextViews) on Android that are in the same Activity (each element within a TableRow). So that the user does not have to do a long scroll looking for the section that interests him, it would be ideal to have buttons at the top that take you to the "height" where the element is. Basically I need the functionality of a button to a local link (the id of a TextView) within the same Activity Is there something like that?

Update

Thanks to the response of @ x4mp73r, this was my final code:

private final void focusOnView(){
    myScrollView.post(new Runnable() {
        @Override
        public void run() {
            myScrollView.smoothScrollTo(0, myTableRow.getTop());
        }
    });
}
    
asked by Edgar 23.02.2017 в 20:50
source

1 answer

1

You can use ScrollView with smoothScroll to be able to go to a specific item:

tuScrollView = (ScrollView) findViewById(R.id.scrollView1);

new Handler().post(new Runnable() {
    @Override
    public void run() {
        tuScrollView .smoothScrollTo(0, tuTextView.getBottom());
    }
});

This is using textviews .

  

NOTE

     

This response was obtained from Stackoverflow . If you want to get a variety of solutions you can visit the following similar questions Programmatically scroll to a specific position in an Android ListView , Scrolling to a row in to TableLayout Programatically , Is there a way to programmatically scroll to scroll view to a specific edit text?   

    
answered by 24.02.2017 / 00:44
source