I can't seem to make the android:windowSoftInputMode="stateVisible|adjustResize" option work. When the soft keyboard shows, the scroll view doesn't automatically scroll to the bottom part.
Edit: I tried using adjustPan instead (stateVisible|adjustPan) but what happens is the scroll view gets disabled.
Solution: Finally, I found a suggestion that works. I created an OnGlobalLayoutListener() and added it to my scroll view. I checked if the height of the root view of my activity(which is my scroll view) changed. If yes, I'm assuming that the soft keyboard is shown.
Click here for more info.
Here's my source code:
AndroidManifest.xml
<application
...
android:theme="@android:style/Theme.NoTitleBar" >
<activity
...
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible|adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
...
</application>
Login Screen with keyboard - scroll view does not scroll
Desired result
Solution: Finally, I found a suggestion that works. I created an OnGlobalLayoutListener() and added it to my scroll view. I checked if the height of the root view of my activity(which is my scroll view) changed. If yes, I'm assuming that the soft keyboard is shown.
Click here for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With