Edit text focus after scrolling view

Asked 2 years ago, Updated 2 years ago, 20 views

There is EditText in the scroll view, and when you press the button, EditText is visible in the Gone.

I want to focus on EditText after moving to the end of the scroll view when pressing the button.

sv.post(newRunable() {
    @Override
     public void run() {
        sv.fullScroll(View.FOCUS_DOWN);
     }
 });

Move to the bottom of the scroll view

et_comment.requestFocus();
et_comment.setCursorVisible(true);
mgr.showSoftInput(et_comment, InputMethodManager.SHOW_FORCED);

I'm focusing on the edit text and uploading the keypad.

If you take out the part that moves down the scroll and just do it, the cursor appears normally in the edit text.

If you move down, the cursor is not visible. When you enter letters without the cursor being visible and click on the edit text, the cursor is now created and the input values that you pressed are updated.

After scrolling, you can't find a cursor in the edit text even if you run it after you clearFocus(); on the scroll view. Is there any other way?

android

2022-09-21 20:11

1 Answers

scrollView.post(newRunable() {
    @Override
    public void run() {
        scroll.scrollTo(0, scroll.getBottom());
    }
});

It's a self-answer I fixed the code and solved it


2022-09-21 20:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.