EditText获得焦点后选中所有内容

EditText et = null;
et.setOnFocusChangeListener(new OnFocusChangeListener(){
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
et.setText("");
}
}
});
 
或者:

android:selectAllOnFocus="true"

这个是获得焦点后选中所有内容
原文地址:https://www.cnblogs.com/miya2012/p/2594721.html