Android 单击时的对话框全屏显示(不包括键盘)

Android dialog on click take full screen (minus the keyboard)

好的,我有一个自定义对话框,它显示为左图。我想点击一个按钮(黑色方块)像右屏一样全屏显示,但不要在键盘后面。我该怎么做?

现在我的对话是这样的

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/comments_relative_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF" >
<EditText
    android:id="@+id/user_comments"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:gravity="top"
    android:textColor="#000000" />

    <TextView
        android:id="@+id/char_count"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:text="2048" />
    <Button
        android:id="@+id/fullscreen"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:background="@drawable/full_screen_button_selector"
        android:minHeight="1dp"
        android:minWidth="1dp" />

</RelativeLayout>

我在 onclick 上试过了,但它不起作用

RelativeLayout r = (RelativeLayout) findViewById(R.id.comments_relative_layout);
FrameLayout.LayoutParams _rootLayoutParams = new     
FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
r.setLayoutParams(_rootLayoutParams);

有人知道怎么做吗?

试试这个:

myDialog.show();
Window window = myDialog.getWindow();
window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);