Making button look pressed?

Put your problem here if it does not fit any of the other categories.

Making button look pressed?

Postby Slimmy » Fri Oct 02, 2009 10:10 am


I have a couple of buttons in my app which look likes the browser/dialer/maps icons and they are all clickable. Problem is I want to make them look pressed like when you press an icon on the homescreen/programs menu, i.e I want that orange(on emulator)/green(on my hero) rectangle to fill in the background of the icon image indicating that you actually pressed that button.

I guess you can do it with a draw/canvas but since it's sort of an already built in feature in android I figured it might be able to do in an easier way. Anyone who can help me out here?

Once Poster
Once Poster
Posts: 1
Joined: Thu Oct 01, 2009 8:17 pm


Postby sachendra » Tue Oct 06, 2009 8:39 am

Hi slimmy,
You can do it using an xml for showing different states of button in different colors or can directly specify in onClick callback method. But in callback you'll have to handle its state, better u go with xml.
Junior Developer
Junior Developer
Posts: 18
Joined: Wed Mar 18, 2009 12:25 pm
Location: Mumbai


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 5 guests