概要
AndroidのEditTextのつまみ部分の色を変更したいときがあった。
変更が反映されず少し手こずったので忘備録としてやり方を記載する。
EditTextのつまみ部分の色をする方法
styleでcolorControlActivated
に変更したい色を定義する。
styles.xml
<style name="CustomTextSelectionHandle">
<item name="android:colorControlActivated">@color/newYellow</item>
</style>
レイアウトのTextViweのthemeにstyleを反映させるとつまみの色が変化する。
style="@style/CustomTextSelectionHandle"
としてもつまみ部分の色は変更されず、themeでないと反映されなかった
layout.xml
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
app:theme="@style/CustomTextSelectionHandle" />