Android WebView focus problem

后端 未结 3 1784
花落未央
花落未央 2020-12-09 05:07

I am fighting with focus management of WebView: WebView messes with focus management of classic components. Here is a simple application with just an EditBox and a WebView i

相关标签:
3条回答
  • 2020-12-09 05:50

    Just add android:focusable="true" to your WebView layout:

    <WebView android:id="@+id/uiContent"
        android:layout_weight="1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:focusable="true"/>
    
    0 讨论(0)
  • 2020-12-09 06:08

    make sure that parent layout that extends "ViewGroup" doesn't have property

    android:descendantFocusability = "blocksDescendants" which prevent child layout from getting focused

    0 讨论(0)
  • 2020-12-09 06:13

    This helped my problem for focus:

    Webview.requestFocus(View.FOCUS_DOWN|View.FOCUS_UP);

    and this for sensitive touch:

    Webview.getSettings().setLightTouchEnabled(true);

    0 讨论(0)
提交回复
热议问题