本文介绍了Android的EDITTEXT提示尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何降低的EditText
提示尺寸?
推荐答案
我也不得不这样做,因为我的暗示并没有在标准尺寸适合在EditText上。所以,我这样做(在XML设置TEXTSIZE到mHintTextSize):
I also had to do this as my hint didn't fit in the EditText at the standard size. So I did this (in the xml set textSize to mHintTextSize):
MYEditText.addTextChangedListener(new TextWatcher(){
@Override
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub
}
@Override
public void beforeTextChanged(CharSequence arg0, int arg1,
int arg2, int arg3) {
// TODO Auto-generated method stub
}
@Override
public void onTextChanged(CharSequence arg0, int start, int before,
int count) {
if (arg0.length() == 0) {
// No entered text so will show hint
editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, mHintTextSize);
} else {
editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, mRealTextSize);
}
}
});
这篇关于Android的EDITTEXT提示尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!