Not sure if this is the best way but it seems to work fine for what
you want to do.

I basically set the Button background image in the layout XML first.
Then set up custom listeners (touch, click, onFocus) that call the
following method that replaces the background image with another
background image

public void setBackgroundCellResource(View view, String position,
boolean selected){
        
        if(position.equals(POSITION_TOP)){
                if(selected){
                        view.setBackgroundResource(R.drawable.btn_52_top_dn);
                }else{
                        view.setBackgroundResource(R.drawable.btn_52_top_up);
                }
        }else if(position.equals(POSITION_BOT)){
                if(selected){
                        view.setBackgroundResource(R.drawable.btn_52_bot_dn);
                }else{
                        view.setBackgroundResource(R.drawable.btn_52_bot_up);
                }
                
        }else if(position.equals(POSITION_MID)){
                if(selected){
                        
//view.setBackgroundResource(R.drawable.btn_52_middle_dn);
                }else{
                        view.setBackgroundResource(R.drawable.btn_52_middle_up);
                }
        }else{
                if(selected){
                        view.setBackgroundResource(R.drawable.btn_single_dn);
                }else{
                        view.setBackgroundResource(R.drawable.btn_single_up);
                }
        }
        
    }

Hope that helps,

~chris



On Wed, Aug 20, 2008 at 5:21 AM, cyntacks <[EMAIL PROTECTED]> wrote:
>
> I know a similar question has been asked before, specifically
> regarding the m5 sdk, but here it goes for the .9 release.
>
> I noticed that the new gui (which is awesome by the way) shows the
> icons on the home screen with no background, but they act like
> ImageButons in that when you click them the background "lights up"
> yellow. Is there a way to replicate this behavior in our applications?
> Currently all of my image buttons have the default "button
> border" (i.e. a big white margin around the image).
>
> I've searched through the new sdk's codebase but can't seem to figure
> out how this was done.
>
> As always, any help would be appreciated.
>
> Kevin
>
>
> >
>



-- 
~chris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to