Android 在工具栏内滑动选项卡视图

Android 在工具栏内滑动选项卡视图,android,tabs,android-viewpager,toolbar,transparent,Android,Tabs,Android Viewpager,Toolbar,Transparent,我的工具栏中嵌入了一个透明的滑动布局,下面还有一个查看页面 从功能上来说,一切都很好。但是,滑块布局没有显示在工具栏的左下角。相反,它在中间和右边浮动: 以下是我的布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.

我的
工具栏中嵌入了一个透明的
滑动布局
,下面还有一个
查看页面

从功能上来说,一切都很好。但是,
滑块布局
没有显示在
工具栏的左下角
。相反,它在中间和右边浮动:

以下是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/tool_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/thunderstorm2"
        android:padding="0dp">

        <com.mjh.android.weathertestlayout.SlidingTabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:backgroundTint="#88ffffff"
            android:paddingLeft="0dp"
            app:tabTextAppearance="@style/TextAppearance.AppCompat.Small">
        </com.mjh.android.weathertestlayout.SlidingTabLayout>

    </android.support.v7.widget.Toolbar>

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ffcccc">
    </android.support.v4.view.ViewPager>

</LinearLayout>
你知道如何在我的
工具栏中将
滑动布局
放回左下角吗


我已经在许多设备和模拟器上试用过,但它仍然是一样的。

我建议您将
幻灯片布局
嵌套在
RelativeLayout

然后可以使用
android:layout\u alignParentBottom
android:layout\u alignParentLeft
将其放置在
工具栏的左下角



尝试在线性布局中嵌套SlidingTableOut(宽度为match_parent,高度为wrap_content)。我已经这样做了,还使用了LinearLayout参数,但它不会改变我看到的任何内容。
adapter =  new ViewPagerAdapter(getSupportFragmentManager(), 3);
pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(adapter);

tabs = (SlidingTabLayout) findViewById(R.id.tab_layout);
tabs.setDistributeEvenly(true);
tabs.setCustomTabColorizer(new SlidingTabLayout.TabColorizer() {
@Override
public int getIndicatorColor(int position) {
    return getResources().getColor(R.color.gray);
}});
tabs.setBackgroundColor(getResources().getColor(R.color.clear));
tabs.setViewPager(pager);
<android.support.v7.widget.Toolbar
    android:id="@+id/tool_bar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/thunderstorm2"
    android:padding="0dp">

   <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.mjh.android.weathertestlayout.SlidingTabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:backgroundTint="#88ffffff"
            android:paddingLeft="0dp"
            app:tabTextAppearance="@style/TextAppearance.AppCompat.Small"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true">
        </com.mjh.android.weathertestlayout.SlidingTabLayout>

   </RelativeLayout>

</android.support.v7.widget.Toolbar>

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffcccc">
</android.support.v4.view.ViewPager>