如何在TabLayout旁边创建图像按钮(包括示例图像)

时间:2019-03-09 18:23:07

标签: android

我正在尝试将图像按钮放在TabLayout旁边,如下所示: This a <code>TabLayout</code> with fragments and search image button beside it

这是一个TabLayout,上面有片段和旁边的搜索图像按钮

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/windowBackground">

    <android.support.design.widget.CoordinatorLayout 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.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabMode="fixed"
            app:tabGravity="fill"
            android:background="@color/colorPrimaryDark"
            app:tabTextColor="@color/colorPrimary"
            app:tabSelectedTextColor="@color/colorPrimary"
            app:tabRippleColor="@color/colorPrimaryDark"
            app:tabIndicatorColor="@color/colorPrimary"/>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
    </android.support.design.widget.CoordinatorLayout>

    <android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true">

    <Button
        android:id="@+id/sign_out_button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        style="?android:borderlessButtonStyle"
        android:textSize="13sp"
        android:textAllCaps="false"
        android:text="@string/sign_out"/>

</android.support.design.widget.NavigationView>

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

0 个答案:

没有答案