在activity中有时须要嵌套调用fragment,但嵌套调用往往带来视图的显示与预期的不一样或是fragment的切换有问题。在使用时要注意几点:
1、fragment中嵌套fragment,子fragment视图无法显示:
例如以下:
父fragment的.xml文件:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:background="#339922"
android:id="@+id/mainfrag">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="hahaha"
/>
子fragment的xml文件:
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned=&