Changing the size of a fragment of user dialogs on a pop-up menu

I have a dialog that is a full-screen screen on smaller screens, but has specific sizes for large screens.

The dialog box has an edit text box and several action buttons in the footer. I need a piece of dialogue for resizing so that the buttons are above the soft keyboard when the keyboard is in focus.

On smaller screens, the following snippet allows you to resize the dialog box.

<style name="fullScreenDialog" parent="android:Theme">
  <item name="android:windowSoftInputMode">adjustResize</item>
</style>

For large screens, the dimensions are set as follows.

@Override
public void onStart() {
    super.onStart();
    if (EPHelper.deviceHasLargeScreen()) {
        Dialog d = getDialog();
        Window w = d.getWindow();

        if (dimenH > 0 && dimenW > 0) {
            w.setLayout(dimenW, dimenH);
        }

I tried using SOFT_INPUT_ADJUST_RESIZE in onViewCreated

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    Window w = getDialog().getWindow();
    w.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}

, . , , . , , .

  • , .
  • - , .

/ → .

+4

All Articles