我是一名可以帮助翻译文本的助手。
我有一个主Activity,其中包含一个导航抽屉,我正在尝试实现一个类似于“播放音乐”应用程序带有选项卡的布局。
MainActivity有一个FrameLayout作为容器:
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
我希望在@+id/container中放置一个带有选项卡的Fragment。
最佳方法是什么?
我认为可以创建一个扩展自Fragment并实现TabListener的MyFragment。相应的布局可能如下所示:
<?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>
但是我该如何继续呢?