Reputation: 1610
I have a ScrollView. Inside it, I have cards-like layout which have EditTexts. My Problem is when I scroll up the ScrollView and tap on one of the EditText in one of the cards, the ScrollView scroll down first and then suddenly scroll up back again like the EditText is being covered with SoftKeyboard. This is only happen when there is focus in EditText yet. If there is the focus already, the view re-arranging only happens when the EditText is being covered with SoftKeyboard.
I understand the scrolling up of ScrollView when the EditText is being covered with SoftKeyboard. But, why the scrollview tries to re-arrange the position of the EditText even it is not being covered with SoftKeyboard ?
The user can still see what he is typing. But, that is hurting the user-experiences.
I am using the "adjustPan" for "windowsSoftInputMode". But, I have tried whatever available in this attribute. It is the same.
I even tried to replicated in separate layout with ScrollView as root container and a bunch of EditTexts. But, then, it is working properly.
The weirdest thing is that scrolling down and suddenly scrolling up back (mentioned above) doesn't happen on the topmost card.
What I want to understand is how the view re-arranging happens on ScrollView if a EditText has to ask for requestFocus when the user tap while there is no focus yet.
Please let me know if you have bumped into this kind of weirdness before.
Upvotes: 1
Views: 945
Reputation: 1610
If someone ever come across with this kind of scenario, here is what I have found out after almost 2 days of sickness.
The reason why this is happening is I am using translationY to animate the movement of the cards. And when that translationY value of the card is not the same as the actual position of the card being defined inside the container (including topMargin & height), when you put the focus into EditText inside this kind of container, the sudden movement(push the EditText into bottom of the screen and then push back that EditText view to be on top of SoftKeyboard) of the ScrollView (which is the root container of the cards) happens.
I still have got any idea why this is happening. But, I do believe the requestFocus method implementation is something to do with translationY value in order to make sure the View to be on top of SoftKeyboard.
Upvotes: 1