android fragment addview,Android中Fragment怎么addView?

Fragment是Android honeycomb 3.0新增的概念,在Android——Fragment介绍、Android

Fragment使用、Android FragmentManage

FragmentTransaction介绍中做了关于Fragment的详细介绍。这一片主要通过一个实例了解Fragment的使用。

先看一下布局文件(layout):

android:orientation=“horizontal” android:layout_width=“match_parent”

android:layout_height=“match_parent”>

class=“com.fragment.main.TitlesFragment”

android:id=“@+id/titles” android:layout_weight=“1″

android:layout_width=“0px” android:layout_height=“match_parent” />

android:layout_width=“0px” android:layout_height=“match_parent”

android:background=“?android:attr/detailsElementBackground” />

布局文件中使用了fragment标签和FrameLayout标签。Android Fragment使用

中介绍了2中嵌入Fragment的方法,这个实例中都用到,从布局文件看到有了fragment标签,这是一种使用方法,FrameLayout标签将会成为第二种加载fragment的载体view。

看一下程序实现(com.fragment

你可能感兴趣的:(android,fragment,addview)