阅读背景:

在Activity运行时添加Fragment

来源:互联网 

 代码:

 activity_main.xml

<LinearLayout xmlns:android="https://schemas.android.com/apk/res/android"
    xmlns:tools="https://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
    
    <fragment class="com.example.fragmentonea.ListFragment"
        android:id="@+id/titles"
        android:layout_weight="1"
        android:layout_width="0px"
        android:layout_height="match_parent"/>
    
    <FrameLayout android:id="@+id/detail"
        android:layout_weight="2"
        android:layout_width="0px"
        android:layout_height="match_parent"
        android:background="?android:attr/detailsElementBackground"/>

</LinearLayout>
<LinearLayout xm



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: