ImageButton press feedback

by Venkatesh D » Tue, 04 Aug 2009 01:29:17 GMT

Sponsored Links
 Hi all,

I am developing an application which has many cool image buttons. On
press or click of any image button there is no feed back to the user
either color change or any kind of contrast change in the button.

I don't prefer to have multiple images for a single image button
loaded onKeyDown and onKeyUp callbacks, simply to avoid the size of
the APK.

Is there any default property provided by the framework which just
takes care of Image Button press and release events with some kind of
feedback to the user on both the events?


ImageButton press feedback

by Jeff Sharkey » Tue, 04 Aug 2009 12:53:52 GMT

 The framework offers "stateful" drawables that automatically change
based on user interaction, such as focus or touch.  Here's an example
of the default Button background is defined: ;a=blob;f=core/res/res/drawable/btn_default.xml;hb=cupcake

When a drawable like this is set as a android:background or
android:src, the framework will handle swapping out the icon based on
state for you.  (You don't need to write onKeyDown, etc.)


Jeff Sharkey


Sponsored Links

Other Threads

1. Search UI not showing

Hello everybody,

I'm having some problems on showing the search UI within an Android
application. I've tried to follow the documentation found on
and the example from API demos

I've created a menu button that calls onSearchRequested() method when
clicked.  Within this method, I've put the following:

public boolean onSearchRequested(){
                Bundle appDataBundle = new Bundle();
            appDataBundle.putString("demo_key", "search");
                startSearch("", false, appDataBundle, false);
                return true;

I don't know if this is correct, but I only want to test if the search
UI was shown properly. When I click the search button on the menu,
that code executes, but nothing happens, and I see a warning on the

Window already focused, ignoring focus gain of:$stub$pr...@436e42a0

Am I missing something? Maybe some XML configuration or similar?



2. How to get all data of one contact ?

Hi all,

Seems no direct way to get all info
(name,number,phone,email,IM, data) of one

Is that so? If I want to get all these data,how could I do?

Thanks for your help.

3. Dialogs don't fill width in landscape mode

4. Just In Time / Ahead Of Time Compiler

5. my wifi can scan AP ,but can't connect to the AP .Thanks for any suggestions.

6. Game using Canvas porting to OpenGL please help

7. TextView Highlight/Select Issue