2015-06-22 36 views
2

當我在我的WebView中單擊輸入文本字段(input type="text")時,該字段顯示軟鍵盤,但光標未顯示。 我可以鍵入文本,但沒有光標... 當發生這種情況時,Logcat說"W/IInputConnectionWrapper﹕ showStatusIcon on inactive InputConnection" or "W/IInputConnectionWrapper﹕ getTextBeforeCursor on inactive InputConnection". 我試圖override我的WebView製作onCheckIsTextEditor() return true;,但沒有任何工作。 請幫忙。Android WebView輸入類型=「文本」光標不顯示

回答

4

我通過設置焦點到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> 
+0

- 它幫助我解決問題與三星Galaxy S3的WebView對Instagram的登錄過程。 –

+0

我在尋找它很長一段時間,謝謝。但'focusable'對我來說已經足夠了,實際上刪除'focusableInTouchMode'使觸摸選擇更順暢! – AbdelHady

0

可能因爲光標顏色而發生。您可以製作自己的自定義光標。

在繪製文件夾color_cursor.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" > 
    <size android:width="2dp" /> 
    <solid android:color="@color/cp_red" /> 
</shape> 

只是爲了記錄創建一個XML文件,並使用該屬性

<item name="android:textCursorDrawable">@drawable/color_cursor</item> 
+0

我不知道有更改光標顏色的方法。但是,改變光標顏色不適合我。無論如何謝謝你的建議。 – Starrover

+0

隨時........ – Vid

相關問題