I am trying to reproduce Honeycomb GMail UI with fragments and cannot. That's what i want
The initial state:
+--------+---------------+ | | | |Accounts| Folders | | | | +--------+---------------+
after selecting a folder:
+--------+---------------+ | | | |Folders | Items | | | | +--------+---------------+
where Accounts, Folders and Items are fragments. (Obviously, the return button should go back to its original state)
I tried the following layout:
<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>
Unfortunately, this does not work, because I cannot transfer the Folders fragment from the right panel to the left panel (the fragment can be added only once). Instead, I can create new folders, but this is a rather resource-intensive process, requires careful state management (especially when you click the "Back" button) and does not look the way I want it to look.
I tried using 3 FrameLayouts (left, middle, right with weights 1, 1.6, 2.56), but I can not get FrameLayout to collapse when the fragment is not displayed. Any help really appreciated
mikea
source share