android:windowSoftInputMode=“adjustResize” when i've already have ScrollView in the activity
-
25-09-2019 - |
Question
I have an activity with this Layouts structure: LinearLayout -> ScrollView -> TableLayout
Below the TableLayout i have EditText, which I want to be scrolled up when the keyboard is active. So according to some reading I've made, i added:
android:windowSoftInputMode="adjustResize"
to AndroidManifest.xml, to the relevant activity, and added a ScrollView wrapper to the activity.xml file, so the Layouts structures of the activity is now as follows: ScrollView -> LinearLayout -> ScrollView -> TableLayout
The problem: The inner ScrollView is not working now... I guess the wrapping ScrollView is taking control when touched...
How can i solve this issue?
Any help will be appreciated. Thanks.
Solution
I was facing the same problem where the virtual keyboard was hiding EditTexts on my screen. I introduced the following property for activity tag in the manifest file:
android:windowSoftInputMode="stateVisible|adjustResize|adjustPan"
Also I needed to add following code in the activity's OnCreate function:
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
This solved the problem and it worked perfectly fine on all resolution emulators and samsung devices. It did fail, though, on Google Nexus S device and I could see the same problem again of virtual keyboard hiding the EditTexts.