android - 如何更改 EditText 的 textSelectHandle 颜色

标签 android

Android 有一个默认的绿色泪滴出现在文本下方以帮助选择文本或位置。如何在没有 @drawable 的情况下更改它的颜色?我尝试了 android:textSelectHandle="@color/colorPrimary" 但这只是让它消失了。

<EditText
  android:inputType="text"
  android:layout_width="fill_parent"
  android:layout_height="match_parent"
  android:layout_toEndOf="@+id/imgMagnifyingGlass"
  android:textAlignment="viewStart"
  android:backgroundTint="@color/colorWhite"
  android:textCursorDrawable="@null"
  android:textSelectHandle="@color/colorPrimary"
  android:textColor="@color/colorGray"
  android:id="@+id/editTextWord" />

最佳答案

我通过将其添加到我的 styles.xml 来修复它:

<item name="colorControlActivated">@color/colorPrimary</item>

关于这个主题的所有其他接受的答案都涉及 @drawable,这似乎是最简单的方法。

关于android - 如何更改 EditText 的 textSelectHandle 颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41311044/

相关文章:

Android 4.2.2,如何为 HttpsURLConnection 启用 TLS 1.2?

android - 假 KeyEvent 不能*完全*像 "real"按钮一样工作。为什么?

Android Studio 挂了

android:onClick xml 未执行

android - 如何邀请 Google Play 管理中心内部测试人员

javascript - 带有动态源的 Html 5 视频在 Android 中不起作用

android - 道路 googleapi : Some places missing and lines passing through edifices

android - onKeyUp 不适用于 KEYCODE_DPAD_CENTER

Android:数据绑定(bind)文本未更新

android - 如何使用改造将 JSON 作为字符串