2012-08-02 34 views
0

是否可以在一個佈局中託管兩個FragmentActivities?Android:在一個佈局中使用兩個FragmentActivities

舉例來說,如果我有以下佈局,可我在主持一個container1和FragmentActivity在container2的?:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context=".MainActivity" > 


<FrameLayout 
    android:id="@+id/container1" 
    android:layout_width="match_parent" 
    android:layout_height="150dp" > 
</FrameLayout> 

<FrameLayout 
    android:id="@+id/container2" 
    android:layout_width="match_parent" 
    android:layout_height="150dp" > 

</FrameLayout> 

一個FragmentActivity如果這是不可能的,我可以有一個FragmentActivity那加載兩個不同的片段,並顯示一個在容器1和一個在容器2中?

回答

0

你有點困惑。佈局不包含活動,活動包含佈局。在你的佈局中,你可以放置View和碎片,所以是的,可以在一個FragmentActivity中加載兩個碎片,或者說它是實現你想要的唯一方法。

相關問題