当视频播放器在标签内处于全屏模式时,如何隐藏操作栏和选项卡布局



我有一个ViewPager,它在一个片段中,这个片段有一个动作栏和一个tabLayout,在其标签上我有一个视频播放器,当我全屏视频时,动作栏和标签布局不会被隐藏,如何获得隐藏动作栏和标签布局的全屏视频?

<LinearLayout
android:id="@+id/main_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<include
    android:id="@+id/app_bar"
    layout="@layout/app_bar" />

<android.support.design.widget.TabLayout
    android:id="@+id/tab_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/app_bar"
    android:background="?attr/colorPrimary"
    android:elevation="6dp"
    android:minHeight="?attr/actionBarSize"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
<android.support.v4.widget.DrawerLayout                         
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layoutDirection="rtl">
<android.support.v4.view.ViewPager
 android:id="@+id/pager"
 android:layout_width="match_parent"
 android:layout_height="fill_parent"
 android:layout_below="@id/tab_layout"/>
<fragment
 android:id="@+id/navigationDrawerFragment"
 android:layout_width="280dp"
 android:layout_height="match_parent"
 android:layout_gravity="start"
 tools:layout="@layout/fragment_navigation_drawer"/>
 </android.support.v4.widget.DrawerLayout>

</LinearLayout>

<?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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="7dp">
<include
 layout="@layout/giraffe_player"
 android:layout_width="match_parent"
 android:layout_height="210dp" />

 <com.jude.easyrecyclerview.EasyRecyclerView
 android:id="@+id/recyclerView"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 app:layout_empty="@layout/view_empty"
 app:layout_progress="@layout/view_progress"
 app:scrollbarStyle="insideOverlay"
 android:layout_marginTop="7dp" />
 </LinearLayout>

当视频播放器全屏时,您可以设置

findViewById(R.id.tab_layout).setVisibility(View.GONE);

退出全屏设置时

findViewById(R.id.tab_layout).setVisibility(View.VISIBLE);