【求助】
aide吧
全部回复
仅看楼主
level 7
111519237二 楼主
输入法delete键怎么实现?
2017年02月25日 09点02分 1
level 11
[喷][喷][喷]
2017年02月26日 03点02分 4
level 11
点击一个按钮删除edit里的最后一个字符?
2017年02月26日 04点02分 6
level 6
有个方法叫deleteSurroundingText..传个1,0…顺便API是个好东西
2017年02月26日 12点02分 8
+1
2017年02月26日 21点02分
level 11
百度
2017年02月26日 12点02分 9
level 7
boolean sFlag = false;
try{
EditText edt=(EditText)findViewById(R.id.edt);
String ss2=edt.getText().toString();
StringBuffer sb = new StringBuffer(ss2);
sb.deleteCharAt(ss2.length()-1);
ss2 =sb.toString();
edt.setText("");
int index = edt.getSelectionStart();//获取光标所在位置
edt.getText().insert(index,ss2);//光标所在位置插入文字
//需要捕获异常的代码
//新加的抛异常代码,但不在这里抛,这里是正常代码
if(edt==null){
sFlag = true;
}
}catch(Exception e){
System.out.print("空异常");Toast.makeText(getApplicationContext(), "!",
Toast.LENGTH_LONG).show();
}
if(sFlag){try
{throw new Exception();
}
catch (Exception e)
{Toast.makeText(getApplicationContext(), "!",
Toast.LENGTH_SHORT).show();
}
}
2017年03月07日 04点03分 10
1