如果edittext是ExpandableListView的子级,则在对焦点进行更改后,在edittext中进行监听,如果我们最小化键盘,然后再次单击该编辑文本,则不会再次出现软键盘。
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
showClearIcon(
(!mClearIconDrawWhenFocused || focused) && !TextUtils.isEmpty(getText().toString()));
super.onFocusChanged(focused, direction, previouslyFocusedRect);
}
清单
android:windowSoftInputMode="adjustPan"