wifi_Switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked)
{
...
wifi_Switch.setBackgroundResource(R.drawable.switch_on);
}
else
{
...
wifi_Switch.setBackgroundResource(R.drawable.switch_off);
}
wifiSwitch(isChecked);
}
});
Android 监听按钮的状态变化
于 2023-07-21 15:01:54 首次发布