Для изменения цвета рукоятки вы можете сделать, как указано here вы это делаете, используя стиль как
<style name="MyCustomTheme" parent="@style/MyNotSoCustomTheme">
<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>
</style>
Для делать это программно проверить тот же вопрос другой ответ here, который делается с помощью отражения
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) {
}
Для изменения цвета выделенного текста вы можете установить textColorHighlight
в xml как
android:textColorHighlight="#ff0000"
через стиль, который вы можете сделать, как
<item name="android:textColorHighlight">@color/m_highlight_blue</item>
спасибо за помощь, мне понравились оба ответа, но ваши были больше о обработчиках текста. Наверное, нет никакого способа просто подкрасить их? да, возможно, сначала вытащите его, а затем затяните его ... – Lokkio