private int softBoardHeight;
private void getSoftBoardHeight() {
rootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (topStart == 0) {
topStart = getPanelHeight();// 沒取到一直取
}
int cur = getPanelHeight();
if (topStart > 0 && softBoardHeight < 100 && cur > 0) {
softBoardHeight = topStart - cur;
}
}
});
}
private int getPanelHeight() {
int[] lo = new int[2];
et_input.getLocationInWindow(lo);
return lo[1];
}