0

I load a web page by using WebView in my app and there are EditText and Button at the bottom of the page. When I press the EditText, the soft input method will show, but the input method hides the EditText and Button.

I want the EditText and Button move to the top of the input method, so the input method won't hide them.

I added the android:windowSoftInputMode="adjustPan" to my activity tag in the AndroidManifest.xml, but it didn't work.

What else can I do?

sth
  • 222,467
  • 53
  • 283
  • 367
Lei Guo
  • 2,550
  • 1
  • 17
  • 22

2 Answers2

1

Rather than using adjustPan property,Try using following property.It works fine for me..

        android:windowSoftInputMode="adjustResize"
Harneet Kaur
  • 4,487
  • 1
  • 16
  • 16
  • 1
    Yes, this is really what I want.By adding the property above to my activity tag in the AndroidManifest.xml, the webview will move upwards enough to show even its bottom when the soft keyboard appears. – Lei Guo Jun 15 '12 at 12:47
0

Try to put your webview in ScrollView layout. Once keyboad will appear the scroll layout will move upwards. Remember you can have only one child in ScrollView layout. Better put some Layout like Linear or Relative in Scrollview then add other child views in that layout.

Take a look at these:

Scrollview vertical and horizontal in android

http://www.androidaspect.com/2012/02/scrollview-tutorial-android-ui.html

Community
  • 1
  • 1
Awais Tariq
  • 7,724
  • 5
  • 31
  • 54
  • Thanks for your answer. After I putting my webview in a ScrollView layout, when the keyboard appear, the csroll layout move upwards to reveal the EditText which is focused. But it did't move enough to reveal all the EditText and Bttons. Is there a way to force the scroll layout to move upwards enough to show even the bottom of the webview? – Lei Guo Jun 15 '12 at 12:29
  • Catch keyboard pop up event and then scroll the scroll view to top manually – Awais Tariq Jun 18 '12 at 06:13