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:

 http://android.git.kernel.org/?p=platform/frameworks/base.git ;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.)

j






-- 
Jeff Sharkey
jshar...@android.com

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links