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. Oops, I crashed the phone

The current version of Floating Image (version 2.5.0, code 36)
randomly crashes Nexus One phones. Obviously I'm looking into fixing
this problem, but I though it would be prudent for me to report this.
It's always a problem if you can crash the phone. As I'm working with
OpenGL I'm guessing this is the problem, as I'm working directly with
the hardware. When the phone crashes it hangs for a couple of minutes,
being very chatty in the log, and then reboots. I will post the log
after the next crash.

Not sure if this will be useful or not, but I thought I ought to
report it. :)

- Mark


2. vold issues

Hi All,

I am currently working on bringing up Froyo on a device on which we
are booting to the sdcard. U-Boot, kernel, and root filesystem are all
there on separate partitions.

We have a partition, /dev/block/mmcblk0p1, which has a FAT32
filesystem to be used as /mnt/sdcard. In Eclair, this worked fine. But
with the new vold, we find that it fails.

I'm using the Freescale i.MX51 platform, my vold.fstab looks like

   dev_mount sdcard /mnt/sdcard auto /devices/platform/mxsdhci.0

I've also tried:

   dev_mount sdcard /mnt/sdcard auto /devices/platform/mxsdhci.0/

   dev_mount sdcard /mnt/sdcard auto /devices/platform/mxsdhci.0/

Niether of those worked either.

Here's the output I get while booting:

   I/Netd    ( 2041): Netd 1.0 starting
   I/Vold    ( 2040): Vold 2.1 (the revenge) firing up
   D/Vold    ( 2040): Volume sdcard state changing -1 (Initializing) -
   D/DirectVolume( 2040): Dv::diskIns - waiting for 6 partitions (mask
   D/Vold    ( 2040): Volume sdcard state changing 0 (No-Media) -> 2
   D/DirectVolume( 2040): Dv:partAdd: part_num = 1, minor = 1
   D/DirectVolume( 2040): Dv:partAdd: pending mask now = 0x7c
   D/DirectVolume( 2040): Dv:partAdd: part_num = 2, minor = 2
   D/DirectVolume( 2040): Dv:partAdd: pending mask now = 0x78
   D/DirectVolume( 2040): Dv:partAdd: part_num = 3, minor = 3
   D/DirectVolume( 2040): Dv:partAdd: pending mask now = 0x70
   D/DirectVolume( 2040): Dv:partAdd: part_num = 4, minor = 4
   D/DirectVolume( 2040): Dv:partAdd: pending mask now = 0x60
   D/DirectVolume( 2040): Dv:partAdd: part_num = 5, minor = 5
   D/DirectVolume( 2040): Dv:partAdd: pending mask now = 0x40
   D/DirectVolume( 2040): Dv:partAdd: part_num = 6, minor = 6
   D/DirectVolume( 2040): Dv:partAdd: pending mask now = 0x6

And here is some output from the vdc command line interface:

   # vdc volume list
   110 sdcard /mnt/sdcard 2
   200 Volumes listed.
   # vdc volume mount /mnt/sdcard
   405 volume operation failed (Device or resource busy)

I can manually mount the device using this command without any error:

   mount -t vfat /dev/block/mmcblk0p1 /mnt/sdcard

Any help with this would be appreciated.



3. Bluetooth headset connection establishment

4. HTC Sense Dutch Date Formatting

5. iPhone like tab

6. Emulator shortcomings regarding the touchscreen interaction

7. facing loading & binding oepngles texture in my Augmented reality program....