There's a way to do this. Simply set your background texture on the
list items, but use a selector for the background. For the state
android:state_selected="true", simply use @android:color/transparent
as the background. This way, when an item is selected, its texture
won't be shown, and you will be able to see the list selector.

On Tue, Sep 16, 2008 at 2:41 PM, David Given <[EMAIL PROTECTED]> wrote:
> I'm drawing a ListView. My graphic designer has specified a texture for
> the selected item; that's fine, I just put it in a drawable and set the
> ListView's listSelector attribute.
>
> However, he's *also* specified a texture for unselected items. I can't
> figure out how to do this. What I've tried:
>
> - set the ListView's background to the texture... doesn't work because
> the texture is scaled to fill the whole list.
>
> - set the list item's background to the texture --- doesn't work because
> the texture is then drawn *on top of* the selector texture, so we don't
> see the texture any more.
>
> - do the above, and set ListView's drawSelectorOnTop --- doesn't work
> because the list selector texture is opaque, and now I don't see the
> list item at all.
>
> I've experimented with using a <selector> drawable; this is honoured for
> listSelector, but doesn't help because listSelector is only drawn once;
> but it's not honoured for the list item's background, so I can't do it
> that way.
>
> The only way out of this I can think of so far is to use code to
> manipulate the list item's background at run time. Not hard, but very
> nasty. There's got to be a cleaner way to do it --- does anyone know one?
>
> --
> ┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
> │
> │ "All power corrupts, but we need electricity." --- Diana Wynne Jones,
> │ _Archer's Goon_
>
>



-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to