How to keep an ActionBar in its place? Take a look at the screenshot. Activity label is not hidden.
try using android:windowSoftInputMode="adjustResize" in your manifest for your "activity" element
android:windowSoftInputMode="adjustResize"
[![enter image description here][1]][1]Here is the solution for this fix - android:windowSoftInputMode="adjustResize" in Manifest File - Make a class "CommentKeyBoardFix.Java" and copy and paste the below code. public class CommentKeyBoardFix { private View mChildOfContent; private int usableHeightPrevious; private FrameLayout.LayoutParams frameLayoutParams; private Rect contentAreaOfWindowBounds = new Rect(); public CommentKeyBoardFix(Activity activity) { FrameLayout content = activity.findViewById(android.R.id.content); mChildOfContent = content.getChildAt(0); mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(this::possiblyResizeChildOfContent); frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams(); } private void possiblyResizeChildOfContent() { int usableHeightNow = computeUsableHeight(); if (usableHeightNow != usableHeightPrevious) { int heightDifference = 0; if (heightDifference > (usableHeightNow /4)) { // keyboard probably just became visible frameLayoutParams.height = usableHeightNow - heightDifference; } else { // keyboard probably just became hidden frameLayoutParams.height = usableHeightNow; } mChildOfContent.layout(contentAreaOfWindowBounds.left, contentAreaOfWindowBounds.top, contentAreaOfWindowBounds.right, contentAreaOfWindowBounds.bottom); mChildOfContent.requestLayout(); usableHeightPrevious = usableHeightNow; } } private int computeUsableHeight() { mChildOfContent.getWindowVisibleDisplayFrame(contentAreaOfWindowBounds); return contentAreaOfWindowBounds.height(); } } And then call this class in your Activity or Fragment setContentView(R.layout.your_comments_layout) CommentKeyBoardFix(this) ---> For Kotlin or new CommentKeyBoardFix(this) ---> For Java