我开发一个11014633与抽屉式导航
和我有内容查看的布局是这样的:
I am developing an andorid application with navigation drawer
and I have a layout for contentview like this:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:dividerHeight="0dp"
android:divider="@android:color/transparent"
android:background="@color/default_color"/>
</android.support.v4.widget.DrawerLayout>
所以,我可以添加和替换片段的抽屉式导航项目的点击。一切都还好至今。
So I can add and replace fragment on navigation drawer item click. Everything okay till now.
但是,在一个情况下,点击导航抽屉一个项目,我需要显示两个片段,而不是一个(就像一个listFragment和细节片段)。我该怎么办呢?我应该添加两个碎片进入的FrameLayout呢?但如何?或者我应该改变的内容查看不同的 drawerLayout
?如果是的话,我该怎么办呢?
But in one case, on clicking an item on navigation drawer I need to show two fragments instead of one ( just like a listFragment and details fragment ). How can I do it? Should I add two fragments into the framelayout then? But how? or should I change the contentView with different drawerLayout
? If yes, how can I do this?
您可以只使用嵌套的片段。创建将动态创建的两个碎片,并将它们添加到其布局另一个片段。
You may just use nested fragments. Create another fragment that will dynamically create both your fragments and add them to its layout.
有关更多信息,请阅读本: http://developer.android。 COM /约/版本/ Android的4.2.html#NestedFragments
For more information read this: http://developer.android.com/about/versions/android-4.2.html#NestedFragments
上一篇:Net::ReadTimeout (Net::ReadTimeout) Selenium RubyReadTimeout、Net、Ruby、Selenium
下一篇:Cucumber/Capybara -- 如何获取当前执行的主机和端口端口、主机、Cucumber、Capybara