Button Setpressed() Onclick January 15, 2024 Post a Comment 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"?><selectorxmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:state_pressed="false"android:drawable="@drawable/button_normal" /><itemandroid:state_pressed="true"android:drawable="@drawable/button_pressed" /></selector>Copythen, 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. Share Post a Comment for "Button Setpressed() Onclick"
Post a Comment for "Button Setpressed() Onclick"