开发者

How to set the colour of the selction background of an android TextView?

开发者 https://www.devze.com 2023-04-03 10:21 出处:网络
In the following picture you can see an android.widget.EditText (left half) where some text is selected:

In the following picture you can see an android.widget.EditText (left half) where some text is selected:

How to set the colour of the selction background of an android TextView?

Strange thing is: You can see the start开发者_运维问答 and end marker of the selection but the actual selection is not highlighted.

I wonder what I forgot or what I did wrong here. How can I ensure that the selected area is highlighted using an appropriate background colour?


for more on StateList, refer this http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList


After a little more experimenting I found the following:

  • the colour of the selection background is indeed set by android:textColorHighlight.
  • The selection is not highlighted when the entry field is in read only mode.

So for me there is nothing to be done about it and i just have to live without a highlighted selection.

0

精彩评论

暂无评论...
验证码 换一张
取 消