Android 将带有滑动选项卡的viewpager作为嵌套格式放置在片段中

Android 将带有滑动选项卡的viewpager作为嵌套格式放置在片段中,android,android-fragments,android-viewpager,Android,Android Fragments,Android Viewpager,我想做什么: 我用的抽屉里有10个碎片 在我试图添加查看寻呼机的一个片段中 滑动标签(根据jake wharton的说明,具有查看寻呼机指示器) 发生了什么: 当我试着这么做的时候 我无法将图中描述的体系结构 下面 问题:: 是否无法在内部放置带滑动标签的查看寻呼机 碎片 如果有,网上有样品吗?(杰克·沃顿的样本完成了 在活动中放置小部件(而不是片段) 如果有其他可用的方法,是否有用于 这个 注意:我知道不建议使用嵌套方式,但我需要获得此架构 架构我正在尝试获取它: 首先,您可以在谷歌上

我想做什么:

  • 我用的抽屉里有10个碎片
  • 在我试图添加查看寻呼机的一个片段中 滑动标签(根据jake wharton的说明,具有查看寻呼机指示器)

  • 发生了什么:

  • 当我试着这么做的时候
  • 我无法将图中描述的体系结构 下面

  • 问题::

  • 是否无法在内部放置带滑动标签的查看寻呼机 碎片
  • 如果有,网上有样品吗?(杰克·沃顿的样本完成了 在活动中放置小部件(而不是片段)
  • 如果有其他可用的方法,是否有用于 这个

  • 注意:我知道不建议使用嵌套方式,但我需要获得此架构


    架构我正在尝试获取它:


    首先,您可以在谷歌上试用此示例。它还包含slidengtablayout类,如果您使用不同的内容,请尝试使用它

    除了导航抽屉外,此项目与您的(布局相同)类似

    那么,让我们做以下几件事:

    您的主要布局可能如下所示:

    <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">
    
        <FrameLayout
            android:id="@+id/content_fragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    
        <LinearLayout
            android:id="@+id/drawer"
            android:layout_width="@dimen/drawer_width"
            android:layout_height="match_parent"
            android:layout_gravity="left"
            android:background="@color/drawer_back"
            android:gravity="left|center_vertical"
            android:orientation="vertical">
    
            <ListView
                android:id="@+id/left_drawer"
                android:layout_width="@dimen/drawer_width"
                android:layout_height="0dip"
                android:layout_gravity="left"
                android:layout_weight="1"
                android:background="@color/drawer_back"
                android:choiceMode="singleChoice"
                android:clipToPadding="false"
                android:divider="@android:color/darker_gray"
                android:dividerHeight="1dp" />
    
        </LinearLayout>
    
    </android.support.v4.widget.DrawerLayout>
    

    你解决这个问题了吗?
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical">
    
        <yourpackage.slidinglayout.SlidingTabLayout
            android:id="@+id/sliding_tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?attr/colorPrimary"/>
    
        <View
            android:layout_width="match_parent"
            android:layout_height="4dp"
            android:background="@drawable/toolbar_shadow" />
    
        <android.support.v4.view.ViewPager
            android:id="@+id/viewpager"
            android:layout_width="match_parent"
            android:layout_height="0px"
            android:layout_weight="1"
            android:layout_marginTop="@dimen/small_padding"
            android:background="@android:color/white"/>
    </LinearLayout>
    
    mCurrentFragment = new SlidingTabsFragment();
    mTransaction.replace(R.id.content_fragment, mCurrentFragment);
    mTransaction.commit();