0

I am new to android and I am facing a problem with tabLayout. I have a layout like below

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".activities.HomepageActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/appbar_padding_top"
        android:fitsSystemWindows="true"
        android:background="@drawable/header_copy">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            android:animationCache="false">

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

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabMode="scrollable"
            android:fillViewport="false" />

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

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

but what happens the viewPager expands under the navigation bar which I don't want. And also I want the toolbar to get hide when I scroll the screen. Please give some light here.

Vadim Kotov
  • 7,103
  • 8
  • 44
  • 57
MrG
  • 169
  • 5
  • 17

1 Answers1

0

Please check this link

http://www.journaldev.com/12958/android-tablayout-viewpager

and this link also

Android CoordinatorLayout + AppbarLayout + Viewpager always scrolling

Hope this will helps you.

Akash
  • 913
  • 6
  • 14