简体   繁体   中英

Keyboard not showing up with scrollView in webView android

I have a webView inside a scrollView

<?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>

But it won't let me get keyboard when I click on form field or edit box in webView like login fields etc

I have tried removing scrollView . perhaps its because once the values are recorded that is I made the webView "Remember" those fields and that is why the keyboard is not showing? How can I fix this

What should I do :(

In the android manifest in the activity tag, see to it you have given this

android:configChanges="orientation|keyboard" 

your code might have

android:configChanges="orientation|keyboardHidden"

check it out and let me know.

can you please check this .read from here

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" 

try this

 InputMethodManager imm = (InputMethodManager)this.getSystemService(Service.INPUT_METHOD_SERVICE);

for hiding

imm.hideSoftInputFromWindow(ed.getWindowToken(), 0); 

to showing

imm.showSoftInput(ed, 0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM