1.DialogFragment 不可取消和点击外部不消失
DialogFragment.getDialog.setCancelable(false);
DialogFragment.getDialog.setCanceledOnTouchOutside(false);
DialogFragment.getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return false;
}
});
2.RadioButton再次点击取消
复写RadioButton toggle()方法
@Override
public void toggle() {
setChecked(!isChecked());
if (!isChecked()) {
((RadioGroup) getParent()).clearCheck();
}
}