Change image button picture on press?

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Change image button picture on press?

Postby lostgame » Fri Apr 03, 2009 6:56 pm

How do I change the picture of an image button when I press it, and then have it change back once it's released, just like buttons?
lostgame
Junior Developer
Junior Developer
 
Posts: 18
Joined: Thu Apr 02, 2009 8:59 pm

Top

Re: Change image button picture on press?

Postby lostgame » Mon Apr 06, 2009 2:37 pm

Bump? :?
lostgame
Junior Developer
Junior Developer
 
Posts: 18
Joined: Thu Apr 02, 2009 8:59 pm

Re: Change image button picture on press?

Postby jagtap.jj1 » Tue Apr 07, 2009 6:54 am

use
"public boolean isPressed()" to check state if selection
if true set use "public void setImageResource(int resId) " to image from resource
else use "public void setImageResource(int resId) " for other image id.
java-android developer
User avatar
jagtap.jj1
Senior Developer
Senior Developer
 
Posts: 124
Joined: Fri Aug 22, 2008 11:52 am
Location: India(Mumbai)

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests