我試圖用碎片重現Honeycomb GMail UI,但不能。這是我想重現Honeycomb GMail UI帶有片段
初始狀態:
+--------+---------------+
| | |
|Accounts| Folders |
| | |
+--------+---------------+
文件夾後,選擇:
+--------+---------------+
| | |
|Folders | Items |
| | |
+--------+---------------+
凡帳目,文件夾和項目的片段。 (顯然,後退按鈕應該到初始狀態)
我嘗試了以下佈局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/root">
<FrameLayout
android:id="@+id/left_pane" android:layout_weight="1"
android:layout_width="0px" android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/right_pane" android:layout_weight="1.6"
android:layout_width="0px" android:layout_height="match_parent" />
</LinearLayout>
不幸的是,因爲我不能從右邊的窗格中移動我的文件夾片段的左側窗格中,這並不工作(片段只能添加一次)。我可以創建新的文件夾,但這是相當浪費資源的,需要仔細的狀態管理(特別是當按下後退按鈕時),而且看起來並不像我想要的那樣。我試過使用3 FrameLayouts(左,中,右與權重1,1.6,2.56),但我不能讓FrameLayout崩潰時,不顯示片段。任何幫助真的讚賞
...的FrameLayouts變成碎片。 ??? – 2011-04-27 23:37:31
我相信這不起作用,因爲在將碎片添加到容器時不能指定佈局參數(請參閱FramentTransaction類)。 – mikea 2011-04-27 23:47:36
查看Honeycomb Gallery API示例。 – 2011-04-28 00:25:34