如果使用coordinatorLayout和tablayout,则viewPager会在导航栏下展开 [英] viewPager is expanding under the navigationbar in case of coordinatorLayout and tablayout
本文介绍了如果使用coordinatorLayout和tablayout,则viewPager会在导航栏下展开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是android的新手,我正面临着tabLayout的问题.我的布局如下所示
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>
但是发生什么情况,viewPager会在我不想要的导航栏下展开.另外,我还希望在滚动屏幕时隐藏工具栏.请在这里给点灯光.
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.
推荐答案
请检查此链接
http://www.journaldev.com/12958/android-tablayout-viewpager
此链接也
Android CoordinatorLayout + AppbarLayout + Viewpager始终滚动
希望这会对您有所帮助.
Hope this will helps you.
这篇关于如果使用coordinatorLayout和tablayout,则viewPager会在导航栏下展开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文