以下是我的平板电脑应用程序的屏幕截图(暂时不使用片段):

如你所见,左边有一个小菜单,上面有我的每个活动的图标。
目前,这些图标启动了新的活动,但我希望他们在右边的框架中启动fragmentactivity,这样一切都会在同一个面板中。
但在仔细阅读有关片段的帖子和文档后,我只能看到片段同时显示:
从这里:http://android-developers.blogspot.com/2011/02/android-30-fragments-api.html
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment class="com.example.android.apis.app.TitlesFragment"
android:id="@+id/titles" android:layout_weight="1"
android:layout_width="0px"
android:layout_height="match_parent" />
<FrameLayout android:id="@+id/details" android:layout_weight="1"
android:layout_width="0px"
android:layout_height="match_parent" />
</LinearLayout>那么,为了在同一位置显示不同的片段,我应该怎么做呢?我想在View=gone上玩是我能想到的最糟糕的主意,不是吗?
非常感谢您的帮助。
发布于 2011-09-20 18:17:29
您必须将您的活动迁移到片段。例如,您将获得RoutePlanner片段、TrafficIssues片段等。当按下其中一个图标时,您将使用FragmentManager将详细信息FrameLayout替换为相应的片段。
https://stackoverflow.com/questions/7483246
复制相似问题