我们都知道给一个activity动态添加fragment的时候 有下面几种添加方式

看一下布局文件

 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     xmlns:tools="http://schemas.android.com/tools"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:orientation="vertical"
 6     >
 7 
 8     <FrameLayout 
 9         android:layout_width="wrap_content"
10         android:layout_height="100dp"
11         android:id="@+id/show_fragment"
12         ></FrameLayout>
13     
14 </LinearLayout>
View Code

相关文章: