Setting gradient color of TextView creates problems with selection color

by ChisterNordvik » Mon, 03 Nov 2008 13:38:29 GMT

Sponsored Links

I have a ListView with lines of TextViews (standings table for Premier

In the first column I want to have a gradient so I have modified my
code like this:

//Top team should have a nice green color
if(position == 0)
        toColor = Color.argb(255, 79, 191, 124);
        grad = new GradientDrawable(Orientation.TOP_BOTTOM,
                        new int[]{Color.GREEN, Color.BLACK, Color.GREEN});

But the selector is not happy with this because the gradient is at the
top of the selector. I tried painting the selector at the top with

But I couldn't get that to look any good. I also tried handling the
selectionChange property of the listview and setting background color
there but how can I clear the selection color when the listItem looses
selection? Do I have to loop through every item?

Are there any better ways of doing this?

Really appreciate any answers!


Other Threads

1. how to set the notification volume to the ringtone volume

Hello everybody,
do you think the snippet:

int volume = audioManager.getStreamVolume(AudioManager.STREAM_RING);
mediaPlayer.setVolume(volume, volume);

is correct for setting the mediaPlayer volume to the value of the
ringtone volume.

Thanks a lot,


2. Is there a way to refer to a group of attributes


3. Find out if the user rated my application in the Market

4. aapt

5. I am a german market developer. How can I see the english comments to my program?

6. Bussiness Model

7. Can someone on 2.0+ test my application?