正文  UI设计 > 文本编辑/EditText >

单击EditText全选里面的内容的方法

percent.setOnTouchListener(this);@Overridepublic boolean onTouch(View v, MotionEvent event) { if(v.getId()==R.id.seekPercent) { percent.selectAll(); InputMethodManager imm = (Inpu......

percent.setOnTouchListener(this);
 
@Override
 public boolean onTouch(View v, MotionEvent event) {
    if(v.getId()==R.id.seekPercent) {
   percent.selectAll();
     InputMethodManager imm = (InputMethodManager)
             context.getSystemService(Context.INPUT_METHOD_SERVICE);
     imm.showSoftInput(v, 0);
     return true;
    }
    return false;
}