Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Holo Selected List Item Color

Can someone tell me the corresponding color code of a selected list item in Holo? Also, what are the colors to generate a long press list item transition in Holo? I know the Holo colors are defined in colors.xml but I'm unsure which ones are used for the selection and long press list item transition. Thanks in advance.

like image 600
William Seemann Avatar asked Feb 17 '13 20:02

William Seemann


2 Answers

If you have a look at Android's platform framework base, especially the themes.xml file, you will find the answer to your question:

https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml

This file defines, amongst others, the following two Holo themes and its corresponding items:

Theme.Holo:

<style name="Theme.Holo">
    ...
    <item name="colorPressedHighlight">@color/holo_blue_light</item>
    <item name="colorLongPressedHighlight">@color/holo_blue_bright</item>
    ...
</style>

Theme.Holo.Light:

<style name="Theme.Holo.Light" parent="Theme.Light">
    ...
    <item name="colorPressedHighlight">@color/holo_blue_light</item>
    <item name="colorLongPressedHighlight">@color/holo_blue_bright</item>
    ...
</style>

I think these are the two colours you are looking for.
The colours are translated into the following hex codes:

<!-- A light Holo shade of blue -->
<color name="holo_blue_light">#ff33b5e5</color>

<!-- A really bright Holo shade of blue -->
<color name="holo_blue_bright">#ff00ddff</color>
like image 170
jenzz Avatar answered Nov 01 '22 08:11

jenzz


You could try this :

android:background="?android:attr/selectableItemBackground"

You could also refer to

How do you get the selection color in Android?

and

Default selector background in Clickable Views

like image 38
lokoko Avatar answered Nov 01 '22 09:11

lokoko