Android library to observe scroll events on scrollable views.

Overview

Android-ObservableScrollView

Build Status Coverage Status Maven Central API Android Arsenal

Android library to observe scroll events on scrollable views.
It's easy to interact with the Toolbar introduced in Android 5.0 Lollipop and may be helpful to implement look and feel of Material Design apps.

Examples

Download from Google Play

Get it on Google Play

Please note that the app on the Play store is not always the latest version.

Download from wercker

If you are a wercker user, you can download the latest build artifact.
See here for details.

wercker status

Install manually

Just clone and execute installDevDebug task with Gradle.
See here for details.

Usage

  1. Add com.github.ksoichiro:android-observablescrollview to your dependencies in build.gradle.
  2. Add ObservableListView or other views you'd like to use.
  3. Write some animation codes to the callbacks such as onScrollChanged, onUpOrCancelMotionEvent, etc.

See the quick start guide for details, and the documentation for further more.

Reference

Apps that use this library

Badge

If you're using this library in your app and you'd like to list it here,
please let me know via email or pull requests or issues.

Contributions

Any contributions are welcome!
Please check the FAQ and contributing guideline before submitting a new issue.

Developed By

Thanks

License

Copyright 2014 Soichiro Kashima

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • SlidingUp improvements

    SlidingUp improvements

    Hi! I have an idea to improve the slidingUp. When you slide the panel must appears on the top an image with parallax effect, in this way on the finish of slide we have a FlexibleSpaceWithImage, and if you continue the scroll the image disappears like your example! What do you think?

    opened by acappelli 34
  • Possible to mimic

    Possible to mimic "Flexible space with image" using this library?

    Hi,

    I'd like to ask if it's possible to implement the next style using this library, as shown on Google's guidelines (called "Flexible space with image") : http://1.bp.blogspot.com/-Vv4SxVSI2DY/VEqQxAf3PWI/AAAAAAAAA7c/mfq7XBrIGgo/s400/activity_transitions%2B%281%29.gif http://www.google.com/design/spec/patterns/scrolling-techniques.html#scrolling-techniques-scrolling

    If it is possible, can you please put a sample, or explain what to do?

    opened by AndroidDeveloperLB 30
  • Flexible space fading action bar doesn't work for Fragments

    Flexible space fading action bar doesn't work for Fragments

    Hi,

    EDIT : Now it's not working for Fragments

    Thank you very much for this excellent library, your library has helped a lot. I found that you added new component named which has Flexible space + image + fading action bar + floating action button, this is like a complete package for me. Except that I need a ListView instead of a ScrollView.

    Can you help me adding a ListView instead of ScrollView ? P.S : My ListView is already a ObservableListView

    Thanks in advance.

    opened by AkshayChordiya 22
  • Problem with Fill Gap & ScrollVIew

    Problem with Fill Gap & ScrollVIew

    Hello. I realised in this activity when i scroll fast down or app the sticky part with the title make some move and shows the layout that scrolling below, in gill gap with recycler view this is not happening.

    And i have a question. Can i do ViewPagerTabActivity with fragment and no with activity? (I mean to extend fragment not activity and hide the supportActionbar thats the parent activity has)? I tried it and replace some staffs like setSupportActionBar because i had the actionbar from the activity but when i scroll up it doesnt hide. Thank you in advance

    opened by pirakleous 17
  • Incorrect scrollY while dynamically show/hide some views in list item.(For expand collapse functionality)

    Incorrect scrollY while dynamically show/hide some views in list item.(For expand collapse functionality)

    @ksoichiro First of all I started my code by looking at the sample (https://github.com/ksoichiro/Android-ObservableScrollView/blob/master/samples/src/main/java/com/github/ksoichiro/android/observablescrollview/samples/FlexibleSpaceWithImageListViewActivity.java). Everything works perfect if we don't do any dynamic update on listview item. But when I show/hide some views on listview item the particular list item height increases and the overall height of listview also increases. In such cases the scrollY returned is wrong sometimes. We are calling listview.requestLayout() after show/hide. But then also the same error in ScrollY occurs.

    opened by midhun3112 12
  • Issue with the RecyclerView state on Android 5.0.2

    Issue with the RecyclerView state on Android 5.0.2

    I'm using ObservableRecyclerView and it works fine on Android <5. But when I run the same code on Lollipop, I get an exception. The RecyclerView has elements, a click on them starts another activity. When I return from that one, the app crashes with the following exception:

    Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: android.support.v7.widget.RecyclerView$SavedState
                at android.os.Parcel.readParcelableCreator(Parcel.java:2289)
                at android.os.Parcel.readParcelable(Parcel.java:2239)
                at android.view.AbsSavedState.<init>(AbsSavedState.java:57)
                at android.view.View$BaseSavedState.<init>(View.java:20038)
                at com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView$SavedState.<init>(ObservableRecyclerView.java:265)
                at com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView$SavedState.<init>(ObservableRecyclerView.java:252)
                at com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView$SavedState$1.createFromParcel(ObservableRecyclerView.java:304)
                at com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView$SavedState$1.createFromParcel(ObservableRecyclerView.java:301)
                at android.os.Parcel.readParcelable(Parcel.java:2246)
                at android.os.Parcel.readValue(Parcel.java:2146)
                at android.os.Parcel.readSparseArrayInternal(Parcel.java:2540)
                at android.os.Parcel.readSparseArray(Parcel.java:1868)
                at android.os.Parcel.readValue(Parcel.java:2203)
                at android.os.Parcel.readArrayMapInternal(Parcel.java:2479)
                at android.os.BaseBundle.unparcel(BaseBundle.java:221)
                at android.os.Bundle.getSparseParcelableArray(Bundle.java:871)
                at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1979)
                at android.app.Activity.onRestoreInstanceState(Activity.java:1022)
                at android.app.Activity.performRestoreInstanceState(Activity.java:977)
                at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1161)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2271)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
                at android.app.ActivityThread.access$800(ActivityThread.java:144)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
                at android.os.Handler.dispatchMessage(Handler.java:102)
                at android.os.Looper.loop(Looper.java:135)
                at android.app.ActivityThread.main(ActivityThread.java:5221)
                at java.lang.reflect.Method.invoke(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:372)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
    

    It looks like on Lollipop, the android.support.v7.widget.RecyclerView is not used by the app since it has the native one available. But the ObservableRecyclerView references that one, leading to the crash.

    opened by scan 12
  • Support for Sliding Tabs+ Viewpager

    Support for Sliding Tabs+ Viewpager

    Thanks for this amazing library Soichiro, I'm curious to implement ToolbarControlListViewActivity in Listview hosted in Fragment with ViewPager setup, I've almost achieved it, but when the toolbar goes off, there is a white space created below the list like you can see in here http://i.imgur.com/RNvJUfY.png If you require i can provide you the code i used to do the setup. Help would be highly appreciated

    opened by nitinmishra27 12
  • Help setting up ObservableScrollView

    Help setting up ObservableScrollView

    Can you please help me how can I use this library to hide/show the toolbar just like Google Play app does?

    I have a main activity and several fragments. Activity layout:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    
    
        <android.support.v4.widget.DrawerLayout
            android:id="@+id/drawer_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <!-- The main content view -->
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">
    
                <include layout="@layout/toolbar" />
    
                <com.astuetz.PagerSlidingTabStrip
                    android:id="@+id/tabs"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    android:background="?attr/colorPrimary"
                    app:pstsIndicatorColor="@color/primary_text_default_material_dark"
                    app:pstsTextColorSelected="@color/primary_text_default_material_dark"
                    app:pstsPaddingMiddle="true"/>
    
                <android.support.v4.view.ViewPager
                    android:id="@+id/pager"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />
            </LinearLayout>
    
            <!-- The navigation drawer -->
            <include layout="@layout/navdrawer" />
    
        </android.support.v4.widget.DrawerLayout>
    </LinearLayout>
    

    Fragment:

    <?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">
    
        <com.github.ksoichiro.android.observablescrollview.ObservableRecyclerView
            android:id="@+id/rcyclrVwWatchlist"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipToPadding="false"
            android:paddingLeft="@dimen/watchlist_list_padding"
            android:paddingTop="@dimen/watchlist_list_padding"
            android:scrollbarStyle="outsideOverlay"
            android:scrollbars="vertical" />
    </RelativeLayout>
    

    How can I achieve this? What sample should I check for this?

    Thanks

    opened by dirkam 11
  • Is it possible to mimic Google I/O 14 Scroll effect?

    Is it possible to mimic Google I/O 14 Scroll effect?

    Hi!

    Is it possible to mimic Google I/O 14 app scroll effect as shown in this gif? (the right one) http://4.bp.blogspot.com/-9jn0pCtadO8/U9_E1mlg8CI/AAAAAAAAAt4/yr9CCSThkpg/s640/change_1.gif

    That effect is related to this post http://android-developers.blogspot.com.es/2014/08/material-design-in-2014-google-io-app.html and I've been looking through the code to find out how to implement it but I've found it too complicated for me right now.

    Do you know a way of mixing your examples to achieve this effect?

    Thank you for you help!

    opened by MrBrightside29 11
  • Direct use of Scroll view callbacks for ViewPager

    Direct use of Scroll view callbacks for ViewPager

    Hi @ksoichiro

    Thank you for such an excellent library & make our lives better.

    Well I was thinking can't we do like this in ViewPager :

    1. Let us consider we have a viewpager with 3 pages which contains ListView or ScrollView
    2. Each ListView or ScrollView has their own ScrollViewCallback implemented which contains the code for showing & hiding the action bar

    I tried using the above method & I was able to hide & show action bar a.k.a Toolbar on scolling but the problem was occuring of white space at the bottom of view. Can this problem be solved ? I know you have a perfect way shown in demo but can we do it this way?

    Let me know your views about this. Thank you

    opened by AkshayChordiya 10
  • The floatbutton isn't triggered when clicked with API 8.

    The floatbutton isn't triggered when clicked with API 8.

    I'm testing the library and everything works fine with my API-21 phone, the floatbutton is triggered when clicked. However, when I try it with API-8 most of the things works good except the floatbutton in FlexibleSpaceWithImageListViewActivity class it's not triggered, likewise when I used a different floatbutton to melnykov's one the same happens and nothing is triggered.

    I set the view to clickable in xml, and typed the following code and no luck:

    mFab.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    Log.v("mFab1:" , "Do you want change color of this button to red?");
                }
            });
    

    I also tried setting the floatbutton as a button and no luck.

    Any suggestions? Thank you very much.

    opened by ghost 9
  • this library has some conflicts with AndroidX

    this library has some conflicts with AndroidX

    when I use this library, this is the error I get :

    Your project has set android.useAndroidX=true, but configuration :app:debugRuntimeClasspath still contains legacy support libraries, which may cause runtime issues. This behavior will not be allowed in Android Gradle plugin 8.0.

    is there any way to fix it?

    opened by 23-59 2
  • WhatsApp uses this library

    WhatsApp uses this library

    Hi, I did see that some of the apps which uses this library are mentioned in ReadMe, I wonder why whatsapp is not listed here?

    As WhatsApp does uses this library in their android-client, you can verify this in their licenses page. Even they've given courtesy.

    opened by jayesh83 0
  • Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.os.BaseBundle.getInt(java.lang.String)' on a null object reference

    Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.os.BaseBundle.getInt(java.lang.String)' on a null object reference

      Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.os.BaseBundle.getInt(java.lang.String)' on a null object reference
       at com.github.ksoichiro.android.observablescrollview.a.restoreState(SourceFile:71)
       at android.support.v4.view.ViewPager.setAdapter(SourceFile:528)
       ---------
       at android.os.AsyncTask.finish(AsyncTask.java:660)
       at android.os.AsyncTask.-wrap1(AsyncTask.java)
       at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:677)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6162)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
    
    opened by arundwi09 1
  • onTouchEvent bug when using ObservableWebView inside NestedScrollView

    onTouchEvent bug when using ObservableWebView inside NestedScrollView

    ObservableWebView has call NestedScrollView.onInterceptTouchEvent(event) in onTouchEvent and then NestedScrollView's mLastMotionY will changed to Y coordinate value of this event's,but this value maybe is bigger than NestedScrollView's max height(when scrolled the WebView),which cause the bug that when I clicked some area inside WebView but it scroll to bottom.

    opened by shineM 0
  • ViewPagerTabRecyclerViewFragment : onclick triggered when scrolling up or down

    ViewPagerTabRecyclerViewFragment : onclick triggered when scrolling up or down

    Hi, Hopefully you can answer me. I havent managed to solve this for month. I did a mix of flexibleRecyclerViewSlidingup and ViewPagerTabRecyclerViewFragment, it means i have a fragment sliding up or down to the bottom with pager containing recyclerViews. I noticed while scrolling up of down that my recyclerView item get clicked in same time which i would like obviously to prevent. In face looking at ViewPagerTabRecyclerViewFragment , there is the same behavior : if we try to start a slight scroll on recyclerView, it can be seen on your samples that a click is triggered in the same time.

    Could you advise a workaround to avoid this to be triggered while moving up or down? Thank you for your feedback Rgds

    opened by davemg3 0
Android library to achieve in an easy way, the behaviour of the home page in the Expedia app, with a pair of auto-scroll circular parallax ListViews.

ListBuddies This library is not maintained anymore and there will be no further releases Android library of a pair of auto-scroll circular parallax Li

JPARDOGO 970 Dec 29, 2022
An Android GridView that can be configured to scroll horizontally or vertically

TwoWayGridView An Android GridView that can be configured to scroll horizontally or vertically. I should have posted this over a year and a half ago,

Jess Anders 656 Jan 9, 2023
Scroll + discover = DiscrollView

Discrollview Regularly, I am pleasantly surprised by websites using a pattern I called the discrollver pattern. I'm sure you already know what I'm tal

Flavien Laurent 1.5k Dec 29, 2022
. Android library that integrate sticky section headers in your RecyclerView

recyclerview-stickyheaders Recyclerview-stickyheaders is an Android library that makes it easy to integrate section headers in your RecyclerView. Thes

null 968 Nov 10, 2022
An android library for section headers that stick to the top

StickyListHeaders StickyListHeaders is an Android library that makes it easy to integrate section headers in your ListView. These section headers stic

Emil Sjölander 5.5k Jan 2, 2023
An Android Animation library which easily add itemanimator to RecyclerView items.

RecyclerView Animators RecyclerView Animators is an Android library that allows developers to easily create RecyclerView with animations. Please feel

Daichi Furiya 11.2k Jan 5, 2023
Android library providing simple way to control divider items (ItemDecoration) of RecyclerView

RecyclerView-FlexibleDivider Android library providing simple way to control divider items of RecyclerView Release Note [Release Note] (https://github

Yoshihito Ikeda 2.4k Dec 18, 2022
Android library defining adapter classes of RecyclerView to manage multiple view types

RecyclerView-MultipleViewTypeAdapter RecyclerView adapter classes for managing multiple view types Release Note [Release Note] (https://github.com/yqr

Yoshihito Ikeda 414 Nov 21, 2022
Dividers is a simple Android library to create easy separators for your RecyclerViews

Dividers Dividers is an Android library to easily create separators for your RecyclerViews. It supports a wide range of dividers from simple ones, tha

Karumi 490 Dec 28, 2022
*** WARNING: This library is no longer maintained *** An easy way to add a simple 'swipe-and-do-something' behavior to your `RecyclerView` items. Just like in Gmail or Inbox apps.

SwipeToAction An easy way to add a simple 'swipe-and-do-something' behavior to your RecyclerView items. Just like in Gmail or Inbox apps. Integration

Victor Calvello 223 Nov 16, 2022
RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)

Advanced RecyclerView This RecyclerView extension library provides Google's Inbox app like swiping, Play Music app like drag-and-drop sorting and expa

Haruki Hasegawa 5.2k Dec 23, 2022
An Android custom ListView and ScrollView with pull to zoom-in.

PullZoomView An Android custom ListView and ScrollView with pull to zoom-in. Features Set ZoomView enable Add HeaderView Custom ZoomView Parallax or N

Frank-Zhu 2.3k Dec 26, 2022
Android ListView that mimics a GridView with asymmetric items. Supports items with row span and column span

AsymmetricGridView An Android custom ListView that implements multiple columns and variable sized elements. Please note that this is currently in a pr

Felipe Lima 1.8k Jan 7, 2023
Drag and drop GridView for Android

DynamicGrid Drag and drop GridView for Android. Depricated It's much better to use solutions based on recycler view. For example https://github.com/h6

Alex Askerov 920 Dec 2, 2022
An Android staggered grid view which supports multiple columns with rows of varying sizes.

AndroidStaggeredGrid ##Notice - Deprecated - 09-2015 This library has been deprecated. We will no longer be shipping any updates or approving communit

Etsy, Inc. 4.8k Dec 29, 2022
AndroidTreeView. TreeView implementation for android

AndroidTreeView Recent changes 2D scrolling mode added, keep in mind this comes with few limitations: you won't be able not place views on right side

Bogdan Melnychuk 2.9k Jan 4, 2023
ItemDecoration for RecyclerView using LinearLayoutManager for Android

RecyclerItemDecoration RecyclerItemDecoration allows you to draw divider between items in recyclerview with multiple ViewType without considering item

magiepooh 328 Dec 27, 2022
[UNMAINTAINED] Sticky Headers decorator for Android's RecyclerView

This project is no longer being maintained sticky-headers-recyclerview This decorator allows you to easily create section headers for RecyclerViews us

timehop 3.7k Dec 31, 2022
A modified version of Android's experimental StaggeredGridView. Includes own OnItemClickListener and OnItemLongClickListener, selector, and fixed position restore.

StaggeredGridView Introduction This is a modified version of Android's experimental StaggeredGridView. The StaggeredGridView allows the user to create

Maurycy Wojtowicz 1.7k Nov 28, 2022