当我按下工具栏时,Viewpager 被向上推

阿里拉

我有问题toolbar当我把他推起来时,viewpager也到顶部,并在底部留出空间(见图)任何解决这个问题的解决方案。

这是我的 activity_main :

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#fafafb">
<android.support.design.widget.CoordinatorLayout
    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:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways|snap"
            android:elevation="5dp"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_below="@id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabMaxWidth="0dp"
            app:tabGravity="fill"
            app:tabMode="fixed"
            app:tabIndicatorHeight="2dp"
            android:elevation="10dp"/>
    </android.support.design.widget.AppBarLayout>
    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/tabs"
        android:background="#fafafb"
        android:layout_marginBottom="?attr/actionBarSize"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>

拉夫萨哈马德007

去掉 :

app:layout_behavior="@string/appbar_scrolling_view_behavior"

从你的 ViewPager

支持库包含@string/appbar_scrolling_view_behavior映射到的特殊字符串资源AppBarLayout.ScrollingViewBehavior用于通知AppBarLayout滚动事件发生在此特定视图上的时间。

阅读更多澄清

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

当我向上滚动RecyclerView时,工具栏和TabLayout不会隐藏

当我向上滚动RecyclerView时,工具栏和TabLayout不会隐藏

如何防止软键盘仅向上推工具栏?

可见键盘时将动画向上推

当键盘打开HTML / CSS时,页脚被向上推?

出现软键盘时,布局没有向上推

CoordinatorLayout + CollapsingToolbarLayout 向上滚动时不设置工具栏

出现键盘时,Android工具栏会向上移动

当按下工具栏的后退按钮时

出现软键盘时如何避免仅将底部导航栏向上推

工具栏-添加向上按钮

片段工具栏中的向上导航

我在线性布局中的滚动视图将其上方的其他小部件向上推

SwiftUI - 如何防止工作表中的鍵盤向上推我的主用戶界面

当android软输入使您的et向上推时,如何使et下面的视图可见?

当文本输入聚焦时,如何避免将视图向上推并覆盖它呢?

在 OpenCV 中旋转屏幕时,屏幕看起来像向左和向上推

键盘向上推页脚

当页脚滚动到视图中时如何向上推固定侧边栏 - 请不要使用第 3 方库

在Android中向上滚动内容时如何隐藏工具栏

向上滚动android时自动隐藏或显示工具栏

如何模仿ncurses中的TTY行为?当我们到达底部时,将屏幕上的所有行向上推吗?

如何获得工具栏上使用的“向上”按钮?

工具栏上的向上按钮在RTL中指向左

向上导航和工具栏标题之间的空间太大

Android工具栏:启用默认的向上按钮

Android:工具栏上的向上按钮处的右边距

使用活动的工具栏从片段向上导航

按下工具栏上的后退按钮