【发布时间】:2014-08-24 21:09:55
【问题描述】:
我有一个带有导航抽屉的主 Activity,我正在尝试实现一个布局,例如带有标签的 Play Music App。
MainActivity 有一个像容器一样的 FrameLayout:
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
我想在@+id/container 中放入一个带有标签的片段。
最好的方法是什么?
我想我可以创建一个 MyFragment 来扩展 Fragment 并实现 TabListener。 相关的布局可能像
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</android.support.v4.view.ViewPager>
但是我该如何继续呢?
【问题讨论】:
标签: android android-fragments android-tabs