需要调整我的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:windowSoftInputMode="adjustResize|stateHidden"
。 - Skizo-ozᴉʞS ツ