【发布时间】:2015-02-13 09:21:30
【问题描述】:
当键盘出现时,需要调整我的 webview 的大小,类似于 Cordova/Phonegap。 现在按照下面的代码,我的输入文本字段被设备键盘覆盖。我想挤压 webview 的高度并使其调整设备键盘上方的高度。
活动代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_home">
<include android:id="@+id/head" layout="@layout/header" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="11dp"
android:layout_marginLeft="11dp"
android:layout_marginRight="11dp"
android:layout_marginTop="2dp"
android:layout_below="@id/head"
android:background="@drawable/overlay_bg2"
android:orientation="vertical"
android:padding="9dp" >
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:isScrollContainer="true"/>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLargeInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible" />
</FrameLayout>
</RelativeLayout>
清单条目:
主题android:theme="@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen"
活动键盘控制android:windowSoftInputMode="adjustResize"
【问题讨论】:
标签: android cordova webview android-softkeyboard