标签活动上方的线性布局

时间:2016-03-12 13:25:02

标签: android android-layout tabs android-xml

我需要在选项卡式活动上方放置带有编辑文本和自定义切换开关的线性布局。

enter image description here

任何想法如何将标签置于线性布局下方

1 个答案:

答案 0 :(得分:1)

试试这个:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/DrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="7dp">



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:minHeight="?attr/actionBarSize"
            android:layout_width="match_parent"
            android:layout_height="100dp"
            app:titleTextColor="@android:color/white"
            android:background="?attr/colorPrimary">

                <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Hello"/>

            <EditText
                android:id="@+id/first"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Wassup!"/>
        </android.support.v7.widget.Toolbar>
    </LinearLayout>
    <android.support.design.widget.TabLayout
        android:id="@+id/sliding_tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabMode="scrollable" />

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="0px"
        android:layout_weight="1"
        android:background="@android:color/white" />
</LinearLayout>


<android.support.v7.widget.RecyclerView
    android:id="@+id/RecyclerView"
    android:layout_width="300dp"
    android:layout_height="match_parent"
    android:layout_gravity="left"
    android:background="#22000000"
    android:scrollbars="vertical">
</android.support.v7.widget.RecyclerView>


</android.support.v4.widget.DrawerLayout>