this is an easy question, in my xml file i have :
Solution 1:
From what I understand is that you are trying to use a button to turn a state off/on, also the button's state will clearly indicate the feature's state.
If I am correct then use custom check box. You will have to anyways define selector for different states of checkbox (as mentioned by user1071979).
Solution 2:
you have to use two images to do this.
button_normal
button_pressed
then create a xml resource in drawable folder
<?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android ="http://schemas.android.com/apk/res/android" > <item android:state_pressed ="false" android:drawable ="@drawable/button_normal" /> <item android:state_pressed ="true" android:drawable ="@drawable/button_pressed" /> </selector >
Copy then, set this file as a background for the imageview. here we are using imageview as button. dont forget to include those two buttons in the drawable folder.
Post a Comment for "Button Setpressed() Onclick"