![](/img/trans.png)
[英]Web pages ported to Android app using PhoneGap will not resize to display
[英]Phonegap: Resize webview on keyboard display in Android
在最新的Android版本中,我有一個類似於(具有固定定位)的模式與facebook對於messenger中的feed / chat中的評論。 我想要的看起來與此類似:
因此,當您專注於輸入時,鍵盤會打開並縮小webview。 它默認不起作用,我找不到任何解決方案。
我嘗試將此首選項添加到config.xml
但adjustResize
沒有執行任何操作, stateVisible
只是在我啟動應用程序時打開鍵盤。
<preference name="android-windowSoftInputMode" value="stateVisible|adjustResize" />
這很奇怪。 從Android文檔開始, adjustResize應該這樣做:
The activity's main window is always resized to
make room for the soft keyboard on screen.
我正在使用Phonegap 3.0,我有一個帶有kitkat的Nexus 5進行測試。
在我使用phonegap 3.0創建的項目中,默認情況下,應用程序是全屏活動,鍵盤隱藏了應用程序,應用程序未調整大小。
我編輯了config.xml並設置了<preference name="fullscreen" value="false" />
,然后應用程序不再是全屏,當打開軟鍵盤時,應用程序被調整大小以適應屏幕的其余部分。
我找到了解決方案..特別為“sencha / phonegap / cordova”用戶。
編輯android清單中的主要活動,然后添加此屬性。
機器人:windowSoftInputMode = “adjustNothing”
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:windowSoftInputMode="adjustNothing" android:label="@string/app_name" android:launchMode="singleTop" android:name="com.company.appName.MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.