How to change the selected color (default green) of a toggle button

by Marco Nelissen » Mon, 09 Mar 2009 00:36:14 GMT

Sponsored Links
 You're talking about a CheckBox, which is derived from CompoundButton,
which is a button with two states. If you want to change how it looks,
you can specify your own Drawable for it, and either change it
yourself when the button changes state, or let the system do it for
you by specifying a drawable that has two states.


Other Threads

1. Compiling and porting Open source android to Nexus One

Dear All:

I wanted to know the steps to follow to port the Open Source Android
to my nexus phone.

I have downloaded the source code, but are there any vendor specific
libraries that i need to include. I am totally blank about it.

I am completely new to it.

Thank you in advance.


2. How to draw smooth gradients?


I'm a little bit puzzled about the way Android treats ARG colors on
devices which seemingly support 24bpp color depth (Desire, Hero).

I've tried to draw smooth gradients like this:

                        Paint mPaint = new Paint();

                        // Draw reds
                        for (int x = 0; x < 256; ++x) {
                                canvas.drawLine(x+20 , 20, x+20 , 70, mPaint);

This doesn't draw a smooth gradient but a RGB_565 version of the red
gradient on the Desire(32bpp?) and on the Android emulator (16bpp).

Albeit, as far as I can tell, there should be a way to draw this in a
smooth way on the Desire:

1. On my HTC Desire I found, that apparently the framebuffer runs at
32bpp color depth:

  $ cat /sys/devices/platform/msm_panel.0/graphics/fb0/bits_per_pixel

2. There's a claim that "The Nexus I, however, has a feature that
allows the system to use modes of both 5-6-5 bit or 8 bit color depth
depending on the image and the designer choice." [1]

The suggested method of touching the image to see a higher color depth
image seems to work in the gallery application on the Desire, too.

So how do I tell the device to use 8-8-8 bit color depth for
displaying the color bar?

Kind regards,




3. On click enlarge the image

4. Quick logcat question

5. Accessing a Web Based Google Map from within an Android Application

6. Speex support?

7. Conditional compile and porting techniques.