How to place a DialogFragment above the keyboard? When you activate EditText , the keyboard closes part of the dialog.

DialogFragment:

 @Override public Dialog onCreateDialog(Bundle savedInstanceState) { int style = DialogFragment.STYLE_NORMAL, theme = 0; theme = R.style.BottomDialogTheme; setStyle(style, theme); Dialog alertDialog = new Dialog(getActivity(), R.style.BottomDialogTheme); alertDialog.setContentView(dialogView); //alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); return alertDialog; } 

initialization from another fragment:

  private void onClickForget(View view) { LayoutInflater inflater = getActivity().getLayoutInflater(); dialogView = inflater.inflate(R.layout.dialog_forget_password, null); BottomLayoutPopup bottomLayoutPopup = BottomLayoutPopup.newInstance(); bottomLayoutPopup.setContentView(dialogView); bottomLayoutPopup.show(getActivity().getSupportFragmentManager(), Consts.TAG_BOTTOM_POPUP); dialogView.findViewById(R.id.btnOk).setOnClickListener(v -> sendRecoveryRequest(bottomLayoutPopup)); dialogView.findViewById(R.id.btnCancel).setOnClickListener(v -> sendForgetRequest(bottomLayoutPopup)); } 

manifest:

 android:windowSoftInputMode="adjustPan" 

(I tried to adjustResize both in the manifest and in onCreateView in the fragment dialog).

dialog layout :

**

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:orientation="vertical"> <LinearLayout android:layout_width="@dimen/dialogWidth" android:layout_height="wrap_content" android:background="@drawable/rounded_forget" android:gravity="center_horizontal" android:orientation="vertical"> <TextView android:id="@+id/tvTitle" style="@style/DialogTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginBottom="@dimen/activity_vertical_margin" android:layout_marginTop="@dimen/activity_vertical_margin" android:text="@string/forgetPasswordLabel" /> <TextView android:id="@+id/tvMessage" style="@style/DialogMessage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin" android:text="@string/tvMessageForgetName" /> <TextView style="@style/ErrorStyle" android:id="@+id/tvErrorEmail" android:visibility="gone" android:text="@string/errorEmail" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <android.support.design.widget.TextInputLayout android:id="@+id/ltPasswordForgetHint" android:layout_width="match_parent" android:layout_height="match_parent" android:textColor="@color/colorSpamText" android:textColorHint="@color/colorSpamText" app:hintTextAppearance="@style/EditTextHint"> <EditText android:id="@+id/etEmailForget" style="@style/EmailEditTextForget" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:textCursorDrawable="@null" /> </android.support.design.widget.TextInputLayout> <LinearLayout android:layout_width="@dimen/dialogRootBtnWidth" android:layout_height="match_parent" android:layout_gravity="right" android:layout_marginLeft="@dimen/activity_vertical_margin" android:layout_marginRight="@dimen/activity_vertical_margin"> <Button android:id="@+id/btnCancel" style="@style/BtnDialog" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="@dimen/activity_vertical_margin" android:layout_weight="0.5" android:background="?attr/selectableItemBackgroundBorderless" android:text="@string/cancel" /> <Button android:id="@+id/btnOk" style="@style/BtnDialog" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.5" android:background="?attr/selectableItemBackgroundBorderless" android:text="@string/dialogOkLabel" /> </LinearLayout> </LinearLayout> </RelativeLayout> 

**

  • Something I do not understand, if the keyboard closes part of the dialogue, then the dialogue is under the keyboard. Why then the question "How to put the DialogFragment under the keyboard?"? - post_zeew
  • @post_zeew typo, sorry. Above the keyboard *) - no news
  • And is EditText in a DialogFragment ? - post_zeew
  • @post_zeew yes. Updated the question, added layout dialog fragment - no news
  • And how will you type something in EditText , if the keyboard is for DialogFragment ? - post_zeew

0