Scrollview - Scroll codeTo not working properly

Asked

Viewed 8 times

0

Well, according to the title, I’m having trouble solving a problem in my code, the line to textView that Scrollview brings through scrollTo code. When I press the button he does not show me the line I wish:

btbuscar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

int indexOfCriteria = (fullText[0].indexOf(criteria));
int lineNumber = (TEXT.getLayout().getLineForOffset(indexOfCriteria));
myscroll.scrollTo(0, TEXT.getLayout().getLineTop(lineNumber));});

And by pressing the button it does not leave the searched attribute in the correct line.

From now on I thank those who can collaborate.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.