Android EditText聚焦时hint消失的简单代码
mInfo = (EditText) findViewById(R.id.fabu_info);
mInfo.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
EditText _v=(EditText)v;
if (!hasFocus) {// 失去焦点
_v.setHint(_v.getTag().toString());
} else {
String hint=_v.getHint().toString();
_v.setTag(hint);
_v.setHint("");
}
}
});