Search code examples
androidwebviewandroid-softkeyboard

Android keyboard not showing when clicking on input in webview


I have a custom webview implemented in my android app. If I touch an input or an text area inside this webview the soft keyboard doesn't show up. I have not overriden any touchlisteners in my webview nor did I change anything in my manifest. Can anyone help me figure out why the keyboard doesn't show?

My layout code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipeRefreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <nl.AEGEE.enschede.android.AEGEEWebView
            android:id="@+id/webView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </android.support.v4.widget.SwipeRefreshLayout>

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleHorizontal"
        android:progressTint="@color/aegee_blue"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="-6dp"
        android:layout_alignParentTop="true" />

</RelativeLayout>

Solution

  • Please try to add these lines to your webview in the XML file.

    android:focusable="true"
    android:focusableInTouchMode="true"
    

    Hope it helps.