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. Is there any way to Abort the instrumentation test case

I have an instrumentation test case that is waiting for an incoming
call. I would like to abort this test case after some time from
outside of this test case. Is there any argument to "adb shell am
instrument" command that will stop the on going instrument test case?


2. Idea for non-US/UK developers with paid apps (was Setup Merchant Account link now available)

Germany, Old Europe and all, is also on the axis of the forgotten. So your
field trip would need to go to the UK.

On Sat, Feb 14, 2009 at 10:12 AM, Mads Kristiansen <


3. Time & Date Settings in DEV PHONE

4. How do I set proper date and time on emulator?

5. Able to install file without adding MIME type in webserver - Very strange!!

6. How to reorder a ListView

7. Unable to check correct row when using CheckedTextView