修改 android:textCursorDrawable 只能改變游標顏色,無法影響長按文字選取時出現的兩個拖拽控點。需透過 Theme 屬性覆寫系統預設 Drawable。
在 res/values/styles.xml 的 AppTheme 中加入以下兩項:
<item name="textSelectHandleLeft">@drawable/text_select_handle_left</item>
<item name="textSelectHandleRight">@drawable/text_select_handle_right</item>
res/drawable/ 目錄,命名為 text_select_handle_left.png、text_select_handle_right.png。drawable-night/ 提供對應深色版本。android:textSelectHandle 單一屬性設定通用控點。TextView 重寫 onDraw() 動態著色,但維護成本較高。