BST Kaal
BST Kaal

Reputation: 3033

Dialog not showing on full screen in Landscape in android.

On my OnListItemClick , i am displaying a Dialog which is working fine i.e. displaying on fullscreen in Portrait Orientation using custom layout for dialog. To support LandScape Orientation, i have added that custom layout in layouts-land folder and the device is picking that layout. But the dialog is not being shown on full screen horizontally. its only filling vertical screen.

    final Dialog prfDialog = new Dialog(getActivity());
    prfDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    prfDialog.setContentView(R.layout.view_student_dailog_layout);
    prfDialog.getWindow().setBackgroundDrawableResource(R.drawable.dialoge_back);

Here is my layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/editStudentMainLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

             // Other View

</RelativeLayout>

Upvotes: 1

Views: 1239

Answers (1)

Boldijar Paul
Boldijar Paul

Reputation: 5495

Make another class which extends Dialog, and add this

    @Override
public void onStart()
{
    super.onStart();
    Dialog dialog = getDialog();
    if (dialog != null)
    {
        int width = ViewGroup.LayoutParams.MATCH_PARENT;
        int height = ViewGroup.LayoutParams.MATCH_PARENT;
        dialog.getWindow().setLayout(width, height);
    }
}

This will force the dialog to be fullscreen.

Maybe if you want want to do this, just use that method after creating your dialog.

Upvotes: 1

Related Questions