EditView和TextView输入字符的时候经常会全屏问题的解决方法

方法1,其实就是加上这一条属性:

android:imeOptions=”flagNoExtractUi”

方法2,自定义控件继承TextView

public class SearchEditText extends EditText {
private int mInputType = EditorInfo.TYPE_CLASS_TEXT;

public SearchEditText(Context context) {
this(context, null);
}

public SearchEditText(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.editTextStyle);
}

public SearchEditText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}

public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
InputConnection ic = new EditableInputConnection(this);
// outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_ENTER_ACTION;
//
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI;
outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO;
// 屏蔽全屏输入
outAttrs.inputType = mInputType;
outAttrs.initialCapsMode = ic.getCursorCapsMode(mInputType);
return ic;
}
}

更多的属性用法请参考官方Api ,http://developer.android.com/reference/android/widget/TextView.html#attr_android:imeOptions