I have a bunch of view in ScrollView
.
Some of them are TextInputEditText
.
When an error occurs I use setError
for particular TextInputEditText
.
And I have such effect.
But my layout is long, and I need to scroll to view with an error. Code:
protected void showInputError(TextInputEditText edtText, @StringRes int resId) {
edtText.setError(getString(resId));
scrollView.post(() -> {
scrollView.scrollTo(0, edtText.getTop());
});
}
All works fine first time. But the app does the same scrolling after any other scrolling. I mean,
- set an error to view
- scroll programmatically to this view
- scroll manually to another place. Application scrolls again to view from step 2.
The main problem: Application scrolls back to view when user scrolls manually (after applying of scrollTo)
Please, give a hint how to overcome this