Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android WebView input type="text" cursor not showing

When I click an input text field (input type="text") in my WebView, the field shows soft keyboard but the cursor is not showing. I can type in texts, but no cursor... When that happens, Logcat says "W/IInputConnectionWrapper﹕ showStatusIcon on inactive InputConnection" or "W/IInputConnectionWrapper﹕ getTextBeforeCursor on inactive InputConnection". I tried to override my WebView making onCheckIsTextEditor() return true;, but nothing works. Please help.

like image 491
Starrover Avatar asked Jun 22 '15 05:06

Starrover


1 Answers

I solved this problem by setting focusable to the WebView's enclosing view.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusable="true"
    android:focusableInTouchMode="true">
    <WebView
        android:id="@+id/web_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
    <include
        android:id="@+id/progress_bar"
        layout="@layout/progress_bar"/>
</FrameLayout>
like image 60
Starrover Avatar answered Sep 27 '22 20:09

Starrover