android - ListSelector applies to the entire list -
I have a simple list like list editor.
& lt; ListView Android: Ad = "@ + ID / List" Android: Layout_width = "Filled_preview" Android: Layout_height = "Fill_Perior" Android: Layout_blo = "@ + ID / Round" Android: List Selector = "# 99000000" Android: Clicking Qualified = "true" Android: Cachecolorhint = "# 00000000" Android: background = "# 00000000" & gt; & Lt; / ListView & gt;
As you can see on Android: list selector = "# 99000000" but "black alpha" color applies to the entire list, not selected items.
So that I have it now, but the complete list still darkens
:: listview_background.xml
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Selector xmlns: Android = "http://schemas.android.com/apk/res/android" & gt; & Lt; Item android: state_enabled = "false" Android: state_focused = "true" android: drawable = "@ drawable / list_normal" /> & Lt; Item Android: state_pressed = "true" android: drawable = "@ drawable / list_pressed" /> & Lt; Android Android: state_focused = "true" android: drawable = "@ drawable / list_active" /> & Lt; / Selector & gt;
:: colors.xml
& lt; Resources & gt; & Lt; Drawable name = "list_normal" & gt; # 96FFFFFF & lt; / Drawable & gt; & Lt; Dryable name = "list_active" & gt; # 66000000 & lt; / Droble & gt; & Lt; Drawable name = "list_proded" & gt; # CA000000 & lt; / Drawable & gt; & Lt; / Resources & gt;
:: xml tag in my list
android: list selector = "@ drawable / listview_background"
I had the same problem. I have a custom background image, and do not make me as that background image Because it will be difficult to represent all the different states.
That's why I want to make an obvious point, there is a semi-transparent band that is overlapped at the top of the focused list and when the user gets "pressed" key or whatever is shaded in the pressed overlay color That is more striking and some more opaque.
The solution was to avoid any @color or @draableable, which refers to the color inside the list. I have two 3x3 pixels PNG files are created I saved with each gamma layer In my case it has two colors of the same color, which are mixed in gimp with different transparency on each color layer. So when you select an item, you get an overlay with 25% color, and when you press it you get a png with 50% color. I put them in my design as bg_list_item_pressed.png and bg_list_item_highlighted.png
Then I set my list selector to:
& lt ;? Xml version = "1.0" encoding = "utf-8" & gt; & Lt; Selector xmlns: Android = "http://schemas.android.com/apk/res/android" & gt; & Lt ;! - selected - & gt; & Lt; Item android: state_focused = "true" Android: state_pressed = "false" android: drawable = "@ drawable / bg_list_item_highlighted" /> & Lt ;! - @drawable / tab_focus - & gt; & Lt ;! - pressed - & gt; & Lt; Item Android: state_pressed = "true" android: drawable = "@ drawable / bg_list_item_pressed" /> & Lt ;! - @ drawable / tab_press - & gt; & Lt; / Selector & gt;
Then I added the layout XML in my list-X to my list:
android: listSelector = "@ drawable / list_selector" Android: drawSelectorOnTop = "True"
Now it actually works how I want to do it. To use a D-pad to select a line, and then entering it, click highlighting and how to get the color that comes later.
Comments
Post a Comment