반응형
android, soft input ( keyboard ) visibility 판단 |
private static final int SOFT_INPUT_MINIMUM_HEIGHT = 300;
ViewGroup.getViewTreeObserver().addOnGlobalLayoutListener( new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
mIsSoftInputShown = isSoftKeyboardShown( Activity, ViewGroup );
}
});
private boolean isSoftKeyboardShown( Activity activity, View containerView ){
int decorViewHeight = activity.getWindow().getDecorView().getHeight();
int pagerHeight = containerView.getHeight();
return decorViewHeight - pagerHeight > SOFT_INPUT_MINIMUM_HEIGHT;
}
반응형
댓글