Android编辑文本光标不可见?

Anu*_*ama 13 android android-edittext

 <shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle">
 <solid android:color="#ffffff" />    
 <stroke android:width="1dp" 
  android:color="#000000" />
 </shape>  
Run Code Online (Sandbox Code Playgroud)

我正在使用此代码setBackgroundResource(R.drawable.selfbg); 当我使用此代码时,光标在Edittext中不可见.

Luc*_*Luc 37

你试过了吗?

android:textCursorDrawable属性设置为@null应该导致使用android:textColor光标颜色.


M D*_*M D 8

尝试将以下内容添加到EditText中:

 android:textCursorDrawable="@null"
 android:background="@null"
Run Code Online (Sandbox Code Playgroud)


Rav*_*avv 6

<EditText  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:textCursorDrawable="@drawable/color_cursor"
    android:background="@drawable/R.drawable.selfbg"/>


Than create drawalble xml: color_cursor

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <size android:width="2dp" />
    <solid android:color="#000000"  />
</shape>
Run Code Online (Sandbox Code Playgroud)


vip*_*tal 5

尝试:

 <item name="android:textCursorDrawable">@null</item>
Run Code Online (Sandbox Code Playgroud)

它需要API-12及更高版本。