我有兩個片段的活性:Android的碎片從查看缺少層次
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:id="@+id/mainlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment
class="com.eyecreate.fragment1"
android:id="@+id/fragment1"
android:layout_height="match_parent"
android:layout_width="269dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true" />
<fragment
android:id="@+id/fragment2"
android:layout_toRightOf="@id/fragment1"
android:layout_alignTop="@id/fragment1"
android:layout_alignBottom="@id/fragment1"
android:layout_alignParentRight="true"
class="com.eyecreate.fragment2"
android:layout_height="match_parent"
android:layout_width="match_parent"></fragment>
</RelativeLayout>
片段1不會在屏幕上顯示出來,而不是在層次瀏覽器,但在代碼的情況下仍然有調用onCreate在其上運行。 fragment2出現並佔用整個屏幕。什麼可能導致它剛剛消失?
將寬度值和佈局更改爲Linear並未改變事情的顯示方式。 – eyecreate 2012-03-04 21:05:39