当我在 WebView 中单击输入文本字段 (input type="text")
时,该字段显示软键盘但未显示光标。
我可以输入文本,但没有光标...
发生这种情况时,Logcat 会显示 “W/IInputConnectionWrapper:非 Activity InputConnection 上的 showStatusIcon”或“W/IInputConnectionWrapper:非 Activity InputConnection 上的 getTextBeforeCursor”。
我试图覆盖
我的 WebView 使 onCheckIsTextEditor() 返回 true;
,但没有任何效果。
请帮忙。
最佳答案
我通过将 focusable 设置为 WebView 的封闭 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>
关于Android WebView 输入类型 ="text"光标未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30972568/