[英]Keyboard not showing up with scrollView in webView android
我在scrollView中有一個webView
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_header"
/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="match_parent"
>
<WebView
android:id="@+id/webView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</ScrollView>
</LinearLayout>
但是當我單擊表單字段或webView中的編輯框(如登錄字段等)時,它不會讓我得到鍵盤
我試着刪除scrollView。 也許是因為一旦記錄了值,我就使webView“記住”了這些字段,這就是為什么鍵盤不顯示的原因? 我怎樣才能解決這個問題
我該怎么辦 :(
在活動標簽的android清單中,查看已給出的標簽
android:configChanges="orientation|keyboard"
您的代碼可能有
android:configChanges="orientation|keyboardHidden"
檢查出來,讓我知道。
你能檢查一下嗎?請從這里閱讀
http://developer.android.com/guide/topics/manifest/activity-element.html
android:windowSoftInputMode=["stateUnspecified",
"stateUnchanged", "stateHidden",
"stateAlwaysHidden", "stateVisible",
"stateAlwaysVisible", "adjustUnspecified",
"adjustResize", "adjustPan"] >
android:configChanges="orientation|keyboard"
嘗試這個
InputMethodManager imm = (InputMethodManager)this.getSystemService(Service.INPUT_METHOD_SERVICE);
隱藏
imm.hideSoftInputFromWindow(ed.getWindowToken(), 0);
顯示
imm.showSoftInput(ed, 0);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.