Adding multiple instances of the same fragment

前端 未结 1 1870
刺人心
刺人心 2021-01-23 04:53

I am attempting to add multiple instances of the same fragment to an activity. Example code is

    FragmentManager fm = getSupportFragmentManager();
    Fragmen         


        
相关标签:
1条回答
  • 2021-01-23 05:13

    The problem seemed to be is using the FrameLayout as the container for the fragments. I change this to

    <LinearLayout
        android:id="@+id/fragment_content"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" />
    

    and it now works fine.

    0 讨论(0)
提交回复
热议问题