Switch button - disable swipe function

后端 未结 6 586
名媛妹妹
名媛妹妹 2020-12-17 09:42

I have a switch button (actually is a custom one) and I want to disable the swipe functionality for some reason; I want the user to be able to click it only. Is

6条回答
  •  萌比男神i
    2020-12-17 09:52

    To disable a Switch use following method

    switchBtn.setEnabled(false);
    

    To make switch not clickable use

    switchBtn.setClickable(false);
    

    where switchBtn is Switch object

提交回复
热议问题