Fragment inside the FrameLayout is not loading

14 Views Asked by At

In the xml when I am adding the fragment tag inside a frame layout the IDE doesn't showing any view of the activity design is just goes blank. But when I am adding others layout like Constraint Layout or Relative layout it's working fine.

<FrameLayout
        android:id="@+id/flFragment"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@+id/bottomNavigationView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
        <fragment
            android:id="@+id/newsNavHostFragment"
            android:name="androidx.navigation.fragment.NavHostFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:defaultNavHost="true"
            app:navGraph="@navigation/news_nav_graph"/>
    </FrameLayout>

The xml where the error is occuring.

0

There are 0 best solutions below