Vitality93
Newbie
Hey all, I've added a background to my buttons with the background: @drawable/button1 option in the properties menu.
What I'm trying to do is have the button change to a @drawable/button1_pressed image so that it looks like the image is being clicked whenever someone pushes it. And then I want it to return to normal after they take their finger off the button.
Right now, I have it changing to the button1_pressed image whenever someone clicks it but then it doesn't change back to it's original state whenever someone takes their finger off. Also, there is a little delay for the button1_pressed image to show up and it doesn't show up if they hold their finger on the button.
Here is the part of the code in my main.java file:
Is there an easier way to do this via propeties? I realize there should be a way to do this by coding but I just can't figure it out... Any suggestions?
-Thanks!
What I'm trying to do is have the button change to a @drawable/button1_pressed image so that it looks like the image is being clicked whenever someone pushes it. And then I want it to return to normal after they take their finger off the button.
Right now, I have it changing to the button1_pressed image whenever someone clicks it but then it doesn't change back to it's original state whenever someone takes their finger off. Also, there is a little delay for the button1_pressed image to show up and it doesn't show up if they hold their finger on the button.
Here is the part of the code in my main.java file:
Code:
button1.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
button1.setBackgroundResource(R.drawable.button1_pressed);
Intent startNewActivityOpen = new Intent(main.this, page2.class);
startActivityForResult(startNewActivityOpen, 0);
}
});
-Thanks!