Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android:windowSoftInputMode="adjustResize" when i've already have ScrollView in the activity

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.

like image 768
ofirbt Avatar asked Jan 05 '11 14:01

ofirbt


1 Answers

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.

like image 151
Zeba Avatar answered Nov 04 '22 22:11

Zeba