2016-12-13 16 views
1

editTextのデフォルトの色をピンク色から青色に変更する方法がわかりません。私が使用して下線を変更することがうまく管理:デフォルトの色を変更する方法editText Andriod Studio

android:backgroundTint="@color/blue" 

をここに私のために私の現在のXMLがここ

<EditText 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:inputType="textPersonName" 
android:text="@string/customword" 
android:ems="10" 
android:id="@+id/customword" 
android:layout_gravity="start" 
android:tint="@color/blue" 
android:textAlignment="viewStart" 
android:textSize="14sp" 
android:textColorLink="@color/blue" //no affect 
android:textColorHint="@color/blue" //no affect 
android:textColorHighlight="@color/blue" //no affect 
android:backgroundTint="@color/blue" 
tools:ignore="UnusedAttribute" /> 

箱EDITTEXTである私はピンクから変更したい側面のためのいくつかのスクリーンショットです: は、ここでは、画像の説明を入力します。

Pink Bubble

Pink Line

ありがとうございます - ジャック

+1

[Edit Edit Text Cursor Color](http://stackoverflow.com/questions/7238450/set-edittext-cursor-color)の可能な複製 – nikis

答えて

1

カーソル(バブル)の色は、あなたのcolorAccentに一致するので、使用したい色にあなたのアクセントカラーを設定する必要があります。

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/blue</item> 
</style> 

それとも、あなたが唯一のアクセントを変更することを好む場合その後

<style name="AppTheme.EditTextOverlay" parent = "ThemeOverlay.AppCompat.Light"> 
    <item name="colorAccent">@color/blue</item> 
</style> 

あなたEditTextにそれを適用します:EditTextの色は、あなたがテーマのオーバーレイを使用することができます

<EditText android:id="@+id/customword" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="start" 
    android:inputType="textPersonName" 
    android:text="@string/customword" 
    android:ems="10" 
    android:textAlignment="viewStart" 
    android:textSize="14sp" 
    android:theme="@style/AppTheme.EditTextOverlay" /> 
+0

非常に感謝しています! ☺ –

0

私はこの回答を見つけましたhere、これで問題は解決しますか?

android:textCursorDrawable属性を@nullに設定すると、アンドロイド:textColorをカーソルの色として使用する必要があります。

関連する問題