Just in case I wasn't clear in what I wanted, let me try again.

I basically want to accomplish the same effect as the latest GMail app
does with its buttons at the bottom of the main Activity. If you click
on the "Compose" button, it is highlighted in blue while it is
pressed. My question is whether this is possible with a selector and a
single actual image of the icon, or whether I necessarily need as many
images as I have different backgrounds.

Again, I realize that the selector itself requires separate images for
each state, but my drawables in that case are simple... For example:

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android";
    android:shape="rectangle">

    <solid
         android:color="#FF0000" />
</shape>

It is much easier to create multiple such drawables for changing the
background as long as there is a single icon image that can be applied
on top of the changing background. Hopefully this is more clear.

Thanks again for your help.

On Feb 16, 10:53 pm, Kookamonga <[email protected]> wrote:
> I have a clickable ImageView that contains an image, say an X, set by
> using the android:src attribute of the ImageView to a drawable/png
> file. Searching around, I've been able to figure out how to use a
> selector to change the background colour of an ImageView when it is
> pressed. But again, this uses the android:src attribute... So my
> question is whether there is an easy way to both set the image to an X
> AND use a selector to change the background when pressed? The obvious
> answer is to have the images in my selector all include the X with
> different backgrounds depending on the state... But I'm hoping that I
> don't have to go and create 2 versions of every image I want to have
> with different backgrounds (right now, the selectors point to simple
> drawables that are solid colours, so no image creation needed). Or do
> I just have to bite the bullet?

-- 
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