键盘没有在webView android中显示scrollView

时间:2013-05-21 04:32:31

标签: java android eclipse

我在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“记住”那些字段,那就是为什么键盘没有显示?我该如何解决这个问题?

我该怎么做:(

2 个答案:

答案 0 :(得分:1)

在活动代码的android清单中,请看到你已经给出了这个

android:configChanges="orientation|keyboard" 

您的代码可能

android:configChanges="orientation|keyboardHidden"

检查一下,让我知道。

答案 1 :(得分:0)

你可以从这里检查这个.read

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);
相关问题