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 enable Android WAP PUSH SMS ?

Hi, All:
      I have a question about WAP PUSH SMS on Android. In Mobile
device, if you want to receive a WAP PUSH SMS, you need to degrade the
SMS security policy level. Then you can acturally receive it. But I
have no idea about how to do this on Android? I try to modify the
androidmanifest.xml that contains
"android.permission.RECEIVE_WAP_PUSH" and change the permission from
dangerous to normal. But there is too many androidmanifest.xml, I
don't know where the exact path I should be modify? Does any one know
how to do that or my thought is wrong? thanks all.


2. Change screen resolution on the fly

I want to change the screen resolution from 1024x600 to 1024x768 when
user use VGA out function.
I had pass the fb_var_screeninfo to the driver at
EGLDisplaySurface.cpp. Use fini() and init() to free and re-initial
DisplayHardware in DisplayHardware.cpp. And then I copy a part of
ReadytoRun() in SurfaceFlinger.cpp to initialize primary screen,
shared control block and OpenGL|ES. After all I set all
DisplayHardware bound as dirty region and then composeSurface().
Are there something I have to do for reinit the display and screen?
If I want redraw all UI ( title bar, background, menu bar or AP's
UI.), How can I do?


3. Working items for Android on X86

4. One activity per view

5. Adding a kernel module as a part of Android code tree

6. How to call an activity of other app from another app

7. How to display Japanese character on TextView