webview加載H5 input標籤,獲取焦點光標丟失解決方法

通過將焦點設在WebView的父佈局來解決了這個問題。
<?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>

此方案參考一個外國老哥的解決方案,親自嘗試有效

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章