如何设置光标位置:
<span style="white-space:pre"> </span>inrichMoney = (EditText) findViewById(R.id.inrich_money);
inrichMoney.addTextChangedListener(new TextWatcher() { //改方法监听文本修改
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
String str = inrichMoney.getText().toString().trim();
if (str.indexOf('0') == 0) {
customToast.errorToast("入伙金额必须大于等于1");
inrichMoney.setText("");
}
if(str.contains(".")){
customToast.errorToast("入伙金额必须大于等于1的整数");
inrichMoney.setText(str.substring(0, str.length()-1));
inrichMoney.setSelection(str.substring(0, str.length()-1).length()); //设置光标在最后
}
}