I want to use a switch button but I want to disable the change status on click, let this change only to the drag option. I try to set onclick
listener to do nothing but when I click on the button always change the state.
Some one know to disable the change status onClick
?
If you want to only change the state of the switch with swipe do the following:
switchbutton = view.findViewById(R.id.switch2);
switchbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
switchbutton.setChecked(!switchbutton.isChecked());
}
});