I am currently getting the height of the soft keyboard by using the ViewTreeObserver like:
private final ViewTreeObserver.OnGlobalLayoutListener mKeyboardLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
final int heightDiff = mRootLayout.getRootView().getHeight() - mRootLayout.getHeight();
if(heightDiff > mStatusBarHeight && mLastHeightDiff != heightDiff){
mSoftKeyboardHeight = heightDiff;
}
mLastHeightDiff = heightDiff;
}
};
But now I need to get the soft keyboard's height before showing it, as we need another view to have the exact same height than the soft keyboard. How could I do that?
Thanks in advance