显示和隐藏操作栏,同时滚动视图寻呼机内容 [英] Show and hide Action bar while scrolling view pager content

查看:174
本文介绍了显示和隐藏操作栏,同时滚动视图寻呼机内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示和隐藏操作栏/工具栏上的谷歌Play商店的应用程序。我使用的顶部,并查看传呼机滑动标签,以显示每个选项卡的内容。下面是谷歌Play商店应用的截图供参考:

I want to show and hide the action bar /toolbar as the Google Play store app. I am using sliding tabs on top and view pager to show the content of each tab. Here is the screenshot of Google play store app for the reference:

我的布局XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <LinearLayout style="@style/HeaderBar"
        android:id="@+id/headerbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

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

        <com.fauzie.sample.tabsspinner.widget.SlidingTabLayout
            android:background="@color/tab_background"
            android:id="@+id/sliding_tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/headerbar">

    </android.support.v4.view.ViewPager>

</RelativeLayout>

在此先感谢。

Thanks in advance.

推荐答案

有一看看这个:

https://github.com/flavienlaurent/NotBoringActionBar

还有这里涉及一个把戏。你需要:

There's a trick involved here. You'll need to:

  1. 裹布局列表视图
  2. 在具有相同高度添加一个假头为你的动作栏大标题
  3. 设置你的动作条叠加到真实
  4. 翻译真正的头时,列表移动(即当假头滚动)。

这是一个有点起初复杂,但一旦你了解它,你看到这一切多么聪明和明​​显的是。链接会给你所有你需要我的希望。

It's a little bit complicated at first but once you understand it, you see how smart and obvious it all is. The link will give you all you need I hope.

我自己使用的链接在自己的应用程序来实现它,它的伟大工程。

I myself used that link to implement it in my own app and it works great.

这篇关于显示和隐藏操作栏,同时滚动视图寻呼机内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆