在适配器中工作不充分EditText.OnFocusChangeListener 他交替调用hasFocus = true / hasFocus = false 然后应用程序冻结
EditText.OnFocusChangeListener editorActionListener = new TextView.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
final EditText amount = (EditText) v;
if (hasFocus) {
if (amount.getText().toString().trim().equals("0") ||
amount.getText().toString().trim().equals("0.0")) {
amount.setText("");
return;
}
} else {
if (amount.getText().toString().trim().length() == 0) {
amount.setText("0");
return;
}
}
}
};
我希望当我将光标放在editText上时,它将变为空 如果它为空,并且我删除了光标,它将变为0