Skip to content Skip to sidebar Skip to footer

Fragment Added To Activity But Does Not Show

I have created an activity and tried to insert a fragment into the activity, but when running it the fragment does not appear when the activity is created. Just a blank space, the

Solution 1:

Ok I think i got it. Move the include to outside of your LinearLayout

<include
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        layout="@layout/app_bar_main" />


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <FrameLayout
        android:id="@+id/main_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </FrameLayout>
</LinearLayout>

Post a Comment for "Fragment Added To Activity But Does Not Show"