简体   繁体   中英

Android soft keyboard under webview

I have full width & full height webview (with a formular). What I need is after focusing input open soft keyboard, but UNDER webview, so the webview should automatically scroll up.

I tried android:windowSoftInputMode but it doesn't work.

Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="sk.eworkperform"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="17" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity android:name="sk.eworkperform.activity.WebBrowserActivity" android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="sk.eworkperform.activity.AdminActivity" >
    </activity>
    <activity android:name="com.dm.zbar.android.scanner.ZBarScannerActivity" >
    </activity>

</application>

Webview layout:

<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webview"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

Thank you

try this on your xml(in the root) which include web view

android:fitsSystemWindows="true"

if it doesn't work try this as well in your menifest in that activity

<activity
        android:name="com.YourActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM