简体   繁体   中英

EditText Insertion Point same color as text (@null not working)

I want to make the EditText Cursor color same as text but:

android:textCursorDrawable="@null"

isn't working.

I changed it using the primeryAccent color in the themes(style) but would prefer if it just takes the color of text(so I wouldn't make many styles for each editText). Am I missing something?

The editText:

<EditText
    android:id="@+id/search_value"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/transparent"
    android:inputType="text"
    android:hint="Search People..."
    android:layout_toRightOf="@id/arrow_search_indicator"
    android:layout_alignTop="@id/search_container"
    android:layout_alignEnd="@id/search_container"
    android:layout_alignBottom="@id/search_container"
    android:layout_marginStart="12dp"
    android:textColor="@color/white"
    android:textColorHint="@color/search_hint_blue"
    android:textCursorDrawable="@null"
    android:maxLines="1"
    android:imeOptions="actionDone"/>

Edited here:

Image:

在此处输入图片说明

That pink thing(Sorry if i misnamed it)

Edittext cursor color you want changes your color.

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

Then 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="3dp" />
    <solid android:color="#FFFFFF"  />
</shape>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM