Drawable is not drawn after setDrawableByLayerId

by tt6 » Thu, 04 Feb 2010 05:50:29 GMT

Sponsored Links

I'm having a problem with displaying a drawable. I have a ImageButton
and a LayerDrawable. I set up an array of Drawable that has one
Drawable for the background (index 0) and one for the image (index 1).
The button would display different background on different states of
the button. What I've done is when the button state changes I replace
the background Drawable like:

        elements[0] = <background drawable object>
        elements[1] = <image drawable object>
        layers = new LayerDrawable(elements);
        layers.setId(0, 0);
        layers.setId(1, 1);

        LayerDrawable ld = (LayerDrawable)button.getDrawable();
        boolean result = ld.setDrawableByLayerId(0, <new

The problem is the initial old background is gone but the new one is
not displayed. What have I done wrong or missed?

Thank you!


Other Threads

1. Menu bhs Indonesia

Tanya dong. Sodara sy tertarik pake android, tapi ingin menunya pake bahasa
indonesia. Sy coba tunjukkan di setting, tp hanya ada 4   bahasa: cina,
vietnam, inggris us, dan inggris uk. Gimana cara tambahkan bahasa indonesia
dipilihan situ?

Terima kasih sebelumnya.


"Indonesian Android Community [id-android]" 

2. Modify Your Kernel Configuration to Accommodate Android Drivers


Can any one please tell me
which changes is required in my kernel for android?

I am successfully compiled android source code for superh arch.
Now i want to porting android on my own hardware device.

Currently I am used Linux kernel kernel in my device.
All necessary hardware is available in my PCB for running android.

But now I don know which changes is necessary in my kernel.

Thank you in advance
Pankaj Gadhiya

unsubscribe: android-porting+unsubscr...@googlegroups.com

3. FM Radio on N1, a light at the end of the tunne

4. problem of creating SQLite database on SDCard

5. Multiple audio stream on android

6. What does "AndroidRuntime onExit calling exit(-5)" means?

7. Kernel panic - not syncing: Attempted to kill init!