как использовать сворачивающуюся панель инструментов в одном фрагменте - PullRequest
0 голосов
/ 17 декабря 2018

Я определяю навигацию по ящикам в основной деятельности и на панели инструментов, TabLayout в app_bar_layout и viewPager в content_main.Я хочу свернуть панель инструментов только в одном фрагменте, которые раздуваются в onItemListener в представлении навигации.Я определяю сворачивающуюся панель инструментов во фрагменте, но приложение разбито. Я гуглюсь и понимаю, что использование включает в панель инструментов, но я не могу реализовать это.что мне делать?

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/ReletiveLayoutStyle">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorPrimary"
        android:fitsSystemWindows="true"
        android:elevation="10dp"
        >

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:minHeight="?android:attr/actionBarSize"
            android:navigationIcon="@drawable/ic_add_black_24dp"
            android:titleTextColor="@color/colorAccent"> 


  </android.support.v7.widget.Toolbar>
        <android.support.design.widget.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/colorPrimary"

            app:tabGravity="fill"
            app:tabIndicatorColor="@color/colorAccent"
            android:layoutDirection="ltr"
            app:tabMode="fixed"
            app:tabSelectedTextColor="@color/colorAccent">
            <android.support.design.widget.TabItem
                android:id="@+id/directTab"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1" />
            <android.support.design.widget.TabItem
                android:id="@+id/notificationsTab"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1" />
            <android.support.design.widget.TabItem
                android:id="@+id/devicesTab"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

            <android.support.design.widget.TabItem
                android:id="@+id/transactionTab"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1" />
            <android.support.design.widget.TabItem
                android:id="@+id/AllPaysTab"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

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



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

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/main_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/appBar"
        />
...