0

When using a dialogFragment I get a white space rectangle at the top of the fragment without knowing why.

What I should get enter image description here

What I actually get enter image description here

My DialogFragment:

 public class SelectDialogFragment extends DialogFragment {

            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            //inflate layout with recycler view
            View v = inflater.inflate(R.layout.select_frag, container, false);
            return v;
        }

}

select_frag.xml

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:orientation="vertical"
    android:background="#000"
    android:layout_height="wrap_content">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="New Text"
        android:id="@+id/textView" />
</RelativeLayout>
Bogdan Daniel
  • 2,689
  • 11
  • 43
  • 76

1 Answers1

7

You should set style without title:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setStyle(STYLE_NO_TITLE, 0);
}

Also you can found more useful example here

Community
  • 1
  • 1
xkor
  • 646
  • 5
  • 11