How can I not focus the last EditText when navigating with the Fragment tab?

I have 3 tabs in ViewPager. The focus in Tab 2 is by default in the first EditText. When I move from Tab 2 to Tab 3 and back, I find that the focus is in the last EditText of tab 2. If I go to Tab 1 and back, the focus will return to the first EditText. Therefore, it seems that when I move "to the right", the focus goes to the last EditText fragment that I was in. I do not want it. I want the focus to be either where I left it, or where it is by default.

In addition, I do not want to just return focus back to the first EditText after returning, because it goes to the last EditText, first of all, scrolls my page down. I want it to move with focus back to my EditText.

Is there a way to prevent the focus from moving to the last EditText in Tab 2 when scrolling to Tab 3?

+5
source share
1 answer

Hey, I know this is an old post, but for the good of others who can watch. I was able to get rid of this problem by putting android: focusable = "false" on the last editText.

0
source

Source: https://habr.com/ru/post/1202379/


All Articles