滚动查看寻呼机内容时显示和隐藏操作栏

mud*_*dit 13 android material-design

我想将操作栏/工具栏显示并隐藏为Google Play商店应用.我在顶部使用滑动标签并查看寻呼机以显示每个标签的内容.以下是Google Play商店应用的截图供参考:

在此输入图像描述 在此输入图像描述

我的布局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>
Run Code Online (Sandbox Code Playgroud)

提前致谢.

kha*_*kha 5

看看这个:

https://github.com/flavienlaurent/NotBoringActionBar

这里有一个技巧.你需要:

  1. 在列表视图中包装您的布局
  2. 添加与操作栏大标题具有相同高度的假标题
  3. 将您的操作栏叠加设置为true
  4. 列表移动时(即滚动假标题时)翻译真实标题.

一开始它有点复杂,但一旦你了解它,你就会发现它是多么聪明和明​​显.该链接将为您提供我所需要的一切.

我自己使用该链接在我自己的应用程序中实现它并且它工作得很好.


ysh*_*smz 5

查看此库:https://github.com/ksoichiro/Android-ObservableScrollView

这肯定会对你有所帮助