I want to change the color of arrows that appear when I am editing text in EditText , I don't know the name of these arrows, How can I do that ?
Asked
Active
Viewed 526 times
1
-
Here's an approach: [Android: Change color / appearance of EditText Select Handle / Anchor](http://stackoverflow.com/a/15133928/2558882). – Vikram Jul 18 '13 at 11:13
2 Answers
1
You can accomplish this by using a custom theme and setting the following:
<item name="android:textSelectHandle">@drawable/text_select_handle_middle</item>
<item name="android:textSelectHandleLeft">@drawable/text_select_handle_left</item>
<item name="android:textSelectHandleRight">@drawable/text_select_handle_right</item>
Or, you can use reflection:
try {
final Field fEditor = TextView.class.getDeclaredField("mEditor");
fEditor.setAccessible(true);
final Object editor = fEditor.get(editText);
final Field fSelectHandleLeft = editor.getClass().getDeclaredField("mSelectHandleLeft");
final Field fSelectHandleRight =
editor.getClass().getDeclaredField("mSelectHandleRight");
final Field fSelectHandleCenter =
editor.getClass().getDeclaredField("mSelectHandleCenter");
fSelectHandleLeft.setAccessible(true);
fSelectHandleRight.setAccessible(true);
fSelectHandleCenter.setAccessible(true);
final Resources res = context.getResources();
fSelectHandleLeft.set(editor, res.getDrawable(R.drawable.text_select_handle_left));
fSelectHandleRight.set(editor, res.getDrawable(R.drawable.text_select_handle_right));
fSelectHandleCenter.set(editor, res.getDrawable(R.drawable.text_select_handle_middle));
} catch (final Exception ignored) {
}

Jared Rummler
- 37,824
- 19
- 133
- 148
0
I don't think you can change that without changing the keyboard layout, which will have to be done separately and here are some tutorials on how to do it:
EDIT:
For the hint color, you can also set a red color for example, see if this does the trick:
android:textColorHint="#FF0000"

g00dy
- 6,752
- 2
- 30
- 43
-
I think it should be more simple ! I just need to change a color – Mohammed Subhi Sheikh Quroush Jul 18 '13 at 11:06
-
2Unfortunatelly I didn't find anything regarding this problem, but I'm not a criteria for this, so good luck at finding the solution! Please poste the answer here if you find one ok ? – g00dy Jul 18 '13 at 11:08
-