mFileNameEt = (EditText) view.findViewById(R.id.fileNameEt);
mFileNameEt.setText(fileName);
mFileNameEt.setSelectAllOnFocus(true);
mFileNameEt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
String fileName = mFileNameEt.getText().toString();
if(hasFocus && !TextUtils.isEmpty(fileName)) {
int stop = fileName.lastIndexOf('.');
if(stop == -1) {
stop = fileName.length();
}
mFileNameEt.setSelection(0, stop); //选中文件名
}
}
});