4

I m trying to create simple FullScreen Dialog with DialogFragment but UI is conflicting with Statusbar

I m getting this View

This issue is raised when calling it from the fragment (TabLayout's Fragment) If I'm calling it from the activity it's working fine.

How can I fix it any help...

I m using this code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:background="@android:color/white"
   android:fitsSystemWindows="true"
   android:orientation="vertical">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <ImageButton
            android:id="@+id/button_close"
            android:layout_width="?attr/actionBarSize"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/selectableItemBackgroundBorderless"
            android:tint="@android:color/white"
            app:srcCompat="@drawable/ic_birthday_cross" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center_vertical"
            android:text="Dialog title"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Title"
            android:textColor="@android:color/white" />

        <Button
            android:id="@+id/button_action"
            style="@style/Widget.AppCompat.Button.Borderless"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:gravity="center"
            android:paddingLeft="2dp"
            android:paddingRight="2dp"
            android:text="Action"
            android:textColor="@android:color/white" />

    </LinearLayout>

</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
    android:id="@+id/nested_scroll_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="none"
    android:scrollingCache="true">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|center_vertical"
        android:text="Full Screen Dialog" />

</android.support.v4.widget.NestedScrollView>

This dialog fragment calling from Tablayout's fragment

FragmentManager fragmentManager =  getFragmentManager(); //getSupportFragmentManager();
        BirthdayDialogFragment newFragment = new BirthdayDialogFragment();
        FragmentTransaction transaction = null;
        if (fragmentManager != null) {
            transaction = fragmentManager.beginTransaction();
        }
        assert transaction != null;
        transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        transaction.add(android.R.id.content, newFragment).addToBackStack(null).commit();

Garg
  • 2,731
  • 2
  • 36
  • 47

0 Answers0