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> **
DialogFragmentunder the keyboard?"? - post_zeewEditTextin aDialogFragment? - post_zeewEditText, if the keyboard is forDialogFragment? - post_zeew