'Showing wrap_content dialog on Full Screen mode

I want to show a dialog using a DialogFragment, without making the application get out from the full-screen mode.

I tried the following the code

 @Override
public void onStart() {
    super.onStart();
    this.moreOptionsViewMvc.registerListener(this);
    final Dialog dialog = getDialog();
    if (dialog != null)
    {
        int width = ViewGroup.LayoutParams.MATCH_PARENT;
        int height = LayoutParams.WRAP_CONTENT;
        dialog.getWindow().setLayout(width, height);
        if( getIsFullScreen(getContext())) {
            dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }
    }
}

The same code works (at least then It doesn't show the status bar which is good enough for me) but when I use int height = LayoutParams.MATCH_PARENT; but I don't want a Full-Screen dialog but still want the dialog to not trigger the Andriod navigation bar and android status toolbar. Is it possible to achieve this?

Update:

Here is the dialog xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
 <ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true">
 <LinearLayout
    style="@style/dialogLinearLayoutStyle">
    <include layout = "@layout/dialogs_general_title_message_views"/>
    <include layout="@layout/dialogs_footer_two_buttons" />

 </LinearLayout>
 </ScrollView>
</RelativeLayout>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source