2017-09-21 6 views
0

私はテキストとしてのEditTextのカーソルの色が同じようにしたいけど:のEditText挿入ポイントと同じ色(@null動作していない)

android:textCursorDrawable="@null" 

が機能していません。

テーマ(スタイル)内のprimeryAccentカラーを使用して変更しましたが、テキストの色を取るだけであれば好きです(各editTextに対して多くのスタイルを作成しません)。何か不足していますか?

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"/> 

ここに編集:

画像:

enter image description here

それピンク色のもの(申し訳ありませんが、私はそれをmisnamed場合)

+0

はアンドロイドが設定します。 属性 "textCursorDrawable"はAPIレベル12以上で利用可能です – Raja

+0

'android:textCursorDrawable =" @ null "'を設定すると、Cursorの色は 'android:textColor'の色である必要があります。 android:textColor'をxmlファイルで明示的に –

+0

addandroidの後にcoloraccentがピンクに設定されている場合、色はピンクのままです:textCursorDrawable = "@ null" –

答えて

1

のEditTextのカーソルの色あなたにあなたの色を変更したい。

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

はその後drawalble XMLを作成します。カーソルの色などの、textColor:@nullするtextCursorDrawable属性アンドロイドを使用することになるはずである: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> 
+0

私の質問を編集して詳細を説明しました。 –

関連する問題