7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

EditTextのカーソル色変える時の注意点

Posted at

textCursorDrawableで指定をするとEditTextのカーソルの色が変えることができる。
http://qiita.com/konifar/items/47d467e3574c9228fdc8

colorをそのまま指定することもできるが、機種によって見た目が変わるのでdrawableファイルで指定した方がよい。

shape_cursor.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <size android:width="1dp"/>
    <solid
        android:color="@color/apply_fragment_cursor_kind_ui"/>
</shape>

挙動の違いメモ(2017.3.29時点)

colorでも出る

  • Galaxy
  • AQUOS(微妙にカーソル線が細くなる…)

drawableじゃないと出ない

  • Xperia
  • Nexus
7
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?