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. Animation fillAfter(true) and click locations

Evening all,

I had a quick questions around animations and what is going on. So I
have buttons in a vertical row down the side of the screen. Upon
clicking the last button the row animates and slides out at the top of
the screen. This works HOWEVER when the user clicks the same button
again (the only button still visible) nothing happens. It seems that
if I click where the button used to be the view reanimates. Does
anyone know why this happens or how I can fix it?



2. AlarmManager Not Firing Receiver


Any experts on AlarmManager out there?  I've got something weird going on.

The basic code to set my repeating alarm works fine.  I can close my app and
the alarm will continue to run like clockwork every five minutes.  It works
fine only if I set it in the app and then close the app.  The code is below:

Intent intent = new Intent(this, AlarmReceiver.class);
Bundle b = new Bundle();
b.putLong("res_id", res_id);

PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent,

AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
(System.currentTimeMillis() + (5 * 1000)), (5 * 60000), pendingIntent);


I've got a registered BootReceiver for re-registering the repeating alarm.
I know it fires on boot b/c the log message clearly shows it is firing and
re-setting the repeating alarm in question for the same frequency.

But the AlarmManager is not firing.  Basically, the nearly identical code
for setRepeating() fires when set from the app and continues to run when the
app is closed, so I know my AlarmReceiver is functioning, but the
AlarmManager is either not broadcasting this alarm or my receiver doesn't
work from an alarm set in the boot receiver.  Below is the code for setting
the alarm from the BootReciver:


Intent i = new Intent(context, AlarmReceiver.class);
Bundle b = new Bundle();
b.putLong("res_id", res_id);

PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
(int)res_id, i, 0);

AlarmManager alarmManager = (AlarmManager)
(System.currentTimeMillis() + (5 * 1000)), (5 * 60000), pendingIntent);


I read somewhere that the AlarmReceiver definition in the manifest needs an
intent-filter or 2 specified.  I don't have any intent-filters, nor would I
know what to put in there.  Is that perhaps why?  I mean it could make sense
b/c the call to setRepeating from the activity w/in my app would still work
b/c the broadcast has more information about what receiver needs the alarm,
whereas when it's being set from the bootreceiver, the receiver in my
manifest isn't defined well enough to get the broadcast?  Here's my manifest
definition for the receiver:

<receiver android:name=".AlarmReceiver" android:process=":remote" />

At the following PDF (Page  25), it suggests a fully-qualified app name

Nick Owens
VP, ThreeClix
Office: (904) 429-7039
Mobile: (847) 565-9392
After Hours: (904) 540-5830


3. Unable to browse /sdcard, permissions d---------

4. Earth (Google Earth)

5. Custom Splash Screen

6. nexDesire v1.1, is it fixed yet?

7. Ada yang tau THEME bagus buat Eclair 2.1 nya HTC Magic ga? sekalian,di unduh nya dimana