[英]Show and hide Action bar while scrolling view pager content
I want to show and hide the action bar /toolbar as the Google Play store app. 我想将操作栏/工具栏显示并隐藏为Google Play商店应用。 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: 以下是Google Play商店应用的截图供参考:
My layout XML : 我的布局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. 提前致谢。
Have a look at this: 看看这个:
https://github.com/flavienlaurent/NotBoringActionBar https://github.com/flavienlaurent/NotBoringActionBar
There's a trick involved here. 这里有一个技巧。 You'll need to: 你需要:
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. 我自己使用该链接在我自己的应用程序中实现它并且它工作得很好。
Checkout this library: https://github.com/ksoichiro/Android-ObservableScrollView 查看此库: https : //github.com/ksoichiro/Android-ObservableScrollView
this will definitely help you 这肯定会对你有所帮助
Check this example to implement this with the new official Android Design Support Library: 检查此示例以使用新的官方Android设计支持库实现此功能:
https://github.com/chrisbanes/cheesesquare https://github.com/chrisbanes/cheesesquare
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.