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
This is a very simple library for Android that allows you to stick an header to a scrollable view and easily apply animation to it

StikkyHeader This is a very simple library for Android that allows you to stick an header to a ListView and easily apply animation to it Usage To use

Carlo Marinangeli 847 Dec 30, 2022
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
Android library to display a ListView whose cells are not rigid but flabby and react to ListView scroll.

FlabbyListView This library is not maintained anymore and there will be no further releases Android library to display a ListView which cells are not

JPARDOGO 762 Nov 23, 2022
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 widget with pull to refresh for all the views,and support loadMore for ListView , RecyclerView, GridView and SwipeRefreshLayout.

CommonPullToRefresh Android widget with pull to refresh for all the views,and support loadMore for ListView,RecyclerView,GridView and SwipeRefreshLayo

null 1.1k Nov 10, 2022
A better ExpandableListView, with animated expandable views for each list item

SlideExpandableListView for Android Not happy with the Android ExpandableListView android offers? Want something like the Spotify app. This library al

Tjerk Wolterink 2k Dec 22, 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 5, 2023
Android library that allows you to bind a LinearLayout with a ListAdapter.

LinearListView Android library that allows you to bind a LinearLayout with a ListAdapter. Download Gradle: dependencies { compile 'com.github.franki

Francesco Sardo 571 Dec 22, 2022
An open source Android library that provides a floating group view at the top of the ExpandableListView

FloatingGroupExpandableListView FloatingGroupExpandableListView is a huge name an open source Android library that provides a floating group view (aka

Diego Lima 376 Nov 28, 2022
An easy to use Drag & Drop List for Android. Direct replacement of the android ListView.

DragNDropListView DragNDropListView is a direct replacement for the stock Android ListView. If you know how to use ListView, you already know how to u

null 187 Dec 22, 2022
Easy to use ListView with pinned sections for Android.

Easy to use ListView with pinned sections for Android 2.1 and higher. Pinned section is a header view which sticks to the top of the list until at lea

Sergej Shafarenka 2.6k Dec 21, 2022
This project aims to provide a reusable pull to refresh widget for Android.

Pull To Refresh for Android Note This library is deprecated, a swipe refresh layout is available in the v4 support library. This project aims to provi

Johan Berg 2.5k Jan 2, 2023
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
Lazy load of images in Android

LazyList A simple library to display images in Android ListView. Images are being downloaded asynchronously in the background. Images are being cached

Fedor Vlasov 1.2k Nov 15, 2022
HorizontalListView is an Android ListView widget which scrolls in a horizontal manner (in contrast with the SDK-provided ListView which scrolls vertically).

HorizontalListView HorizontalListView is an Android ListView widget which scrolls in a horizontal manner (in contrast with the SDK-provided ListView w

MeetMe 722 Nov 10, 2022
Horizontal list view for Android which allows variable items widths

Deprecated This widget is now deprecated and it won't be updated anymore. Use RecyclerView instead Horizontal Variable ListView Horizontal ListView fo

Alessandro Crugnola 862 Nov 15, 2022
A ListView with pinned section headers for Android

PinnedHeaderListView This library provides a sectioned ListView with pinned headers. It looks and feels much like the default contacts app does on And

James Smith 665 Nov 29, 2022
A generic, customizable, open source Android ListView implementation that has 'Pull to Refresh' functionality.

Android 'Pull to Refresh' ListView library Demo video: http://www.youtube.com/watch?v=VjmdELnm3GI Project A generic, customizable, open source Android

Erik Wallentinsen 639 Nov 17, 2022
Parallax ScrollView and ListView for Android

Parallax Scrolls Parallax ListView and ScrollView for Android This project includes ScrollView with one or more parallaxed views ListView with paralla

Nir Hartmann 851 Dec 3, 2022