Android: windowSoftInputMode = "adjustResize" when I already have a ScrollView in activity

I have activity with this Layouts structure: LinearLayout -> ScrollView -> TableLayout

Below TableLayout, I have an EditText that I want to scroll when the keyboard is active. Therefore, according to some data that I made, I added:

android:windowSoftInputMode="adjustResize" 

in AndroidManifest.xml, I added the ScrollView wrapper to the activity.xml file to the corresponding action, so the Layouts structures of this kind now look like this: ScrollView → LinearLayout → ScrollView → TableLayout

Problem: The internal ScrollView is no longer working ... I believe that the wrapping ScrollView takes control when touched ...

How can I solve this problem?

Any help would be appreciated. Thanks.

+8
android layout
source share
1 answer

I ran into the same issue when the virtual keyboard was hiding EditTexts on my screen. I entered the following activity tag property into the manifest file:

  android:windowSoftInputMode="stateVisible|adjustResize|adjustPan" 

I also need to add the following code to the OnCreate function:

 this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 

This solved the problem, and it worked perfectly on all resolution emulators and samsung devices. However, this did not work on the Google Nexus S device, and I again saw the same problem as the virtual keyboard hiding EditTexts.

+10
source share

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


All Articles