Android ListView with sticky headers

Overview

DEPRECATED

HeaderListView is deprecated. No new development will be taking place.

Quickstart

  1. Import the HeaderListView module in your Android Studio project.
  2. Replace your ListView with HeaderListView
  3. Implement a subclass of SectionAdapter
  4. Set it to your HeaderListView with setAdapter(SectionAdapter adapter)

HeaderListView

HeaderListView is a list view with sections and with a cool iOS-like "sticky" section headers. Notice that HeaderListView is not a subclass of Android's ListView but uses composition. Hence, you will need to call getListView() to access the underlying ListView.

Comments
  • onRowItemClick(...) not called

    onRowItemClick(...) not called

    Thanks for your fantastic work, I do enjoy working with HeaderListView a lot. Nevertheless I have one problem related to click events.

    I implemented the onRowItemClick(...) method in my Section Adapter. Unfortunately it is not called and I don't know why. Do I need to "attach" it to the HeaderListView?

    Please let me know if you need further information.

    It would be very helpful if you would include an example for this in the HeaderListViewDemo.

    Thank you & best regards, Sebastian

    opened by sebastiansieber 6
  • Could not find class

    Could not find class

    I have added the project in my workspace and added the project to the build path, but I still get the "could not find class com.applidium.headerlistview.HeaderlistView. I am not sure what else needs to be done, although I am able to run the DEMO.

    opened by EdwardSeshoka 5
  • Sections without any row items

    Sections without any row items

    I am currently using the HeaderListView to display data where some sections might have no row items (the section header is and should be shown regardless of this fact). Now, when I scroll down through the HeaderListView I am experiencing a weird bug for those section headers without any rows. As soon as they begin to exit the visible area, it is overridden by a previously shown section header view.

    I can provide some screenshots to clarify the issue if wanted.

    bug 
    opened by AustrianDudes 4
  • HeaderListViewOnScrollListener.updateScrollBar

    HeaderListViewOnScrollListener.updateScrollBar

    I have imported your project and created a new project using the library given. It works fine till the values are static i have the setContentView() set as HeaderListview id. But when i change the from listview to HeaderListview in xml file it gives me the following error. " java.lang.ArithmeticException: / by zero at com.applidium.headerlistview.HeaderListView$HeaderListViewOnScrollListener.updateScrollBar(HeaderListView.java:215) at com.applidium.headerlistview.HeaderListView$HeaderListViewOnScrollListener.onScroll(HeaderListView.java:115) "

    Please help me in solving this error. I need to setContentView() a different layout as i have other elements also on the same xml file.

    opened by androiddeveloper30 4
  • Programmatically scroll to section header

    Programmatically scroll to section header

    Is there any way to programmatically scroll to a particular section header? I have buttons along the top of my ListView which represent the different section headers, and I want to scroll to the appropriate section upon tapping them. Is this possible?

    opened by codyrotwein 3
  • getSectionHeaderView method doesn't work

    getSectionHeaderView method doesn't work

    Hello, I tried to implement this library in my project as your demo but getSectionHeaderView did not work or I missed something. I share screenshot and implemented gist file. Thank you for your help. screen shot 2014-11-04 at 10 22 09

    https://gist.github.com/serhatsezer/bfc205aedc3222f4a4ea

    opened by serhatsezer 3
  • Is it possible to stop the scrolling?

    Is it possible to stop the scrolling?

    I tried setEnabled(False) and also setClickable(False) but they don't work. The thing is I need to stop the list from being scrollable when I press on a list item.

    opened by alin-rosu 2
  • Populating header and row dynamically

    Populating header and row dynamically

    Hello how can i inject the items below inside SectionAdapter ?

        List<Item> items = new ArrayList<Item>();
        items.add(new Header("Header 1"));
        items.add(new ListItem("Text 1", "Rabble rabble"));
        items.add(new ListItem("Text 2", "Rabble rabble"));
        items.add(new ListItem("Text 3", "Rabble rabble"));
        items.add(new ListItem("Text 4", "Rabble rabble"));
    
        items.add(new Header("Header 2"));
        items.add(new ListItem("Text 5", "Rabble rabble"));
        items.add(new ListItem("Text 6", "Rabble rabble"));
        items.add(new ListItem("Text 7", "Rabble rabble"));
        items.add(new ListItem("Text 8", "Rabble rabble"));
        items.add(new ListItem("Text 9", "Rabble rabble"));
        items.add(new ListItem("Text 10", "Rabble rabble"));
    
    opened by dimitrireef 2
  • Section with dynamic rows

    Section with dynamic rows

    Hello, i am working on an app. I want to display the rows with dynamic size. But, as your function @Override public int numberOfRows(int section) { 34; }

    Which creates 35 rows in each section. I want 2 rows in first section, 5 rows in second section.. like wise.. How can i achieve this? Thanks in advance..!! :)

    opened by mitesh-shah 2
  • java.lang.NoSuchMethodError in sample

    java.lang.NoSuchMethodError in sample

    Hello,

    I just imported sample project in android studio to run on a GT-S5830 Android 2.3.3 (API10). Sample Application crash when entering onStickyHeaderChanged method using setAlpha :

    sample.TestActivity.onStickyHeaderChanged(TestActivity.java:203)

    When removing this line for test, listView can scroll down, but can't scroll back to the top.

    Can you fix this to get good practices for making a fully fonctional implementation ? Many thx !

    opened by djimondev 2
  • Setup gradle

    Setup gradle

    Hi, I wanted to try your library but I think your local environnement configuration was not like mine and I never get it to work. To avoid that I re-configure the entire project with gradle and I include the gradle wrapper. I also removed some eclipse files and some old maven configuration files (I guess). I hope it can help! :-). In the future I will create a dependancy in a mvn repo on my github to be able to use it without having to include the source code in my project.

    opened by elodieferrais 2
  • java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1

    java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1

    Hello,

    When i have bind listview with real data. i am getting below error. with out scrolling listview it is working fine. but once i scroll page then its crash app.

    Please check screenshot screenshot

    java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1 at java.util.ArrayList.get(ArrayList.java:310) at com.applidium.headerlistviewdemo.DemoActivity$1.numberOfRows(DemoActivity.java:43) at com.applidium.headerlistview.HeaderListView$HeaderListViewOnScrollListener.onScroll(HeaderListView.java:151)

    Please check my code...

    DemoActivity.txt

    opened by nileshpambhar 2
  • Adding Custom OnScrollListener forcing the section header scrolling

    Adding Custom OnScrollListener forcing the section header scrolling

    Hi,

    I have added my custom OnScrollListener which is AbsListView.OnScrolllistener on HeaderListView ,because its own onscrolllistener is required for minimum Api LEVEL 23(my minimum is 15). It is forcing the section headers scrolling.I want to fix the sectional headrers.Kindly give me some advice.

    Below is my custom implementation:- MyClass implements AbsListView.OnScrollListener { @Bind(R.id.receipt_list) HeaderListView mReceiptsList;

        mReceiptsList.getListView().setOnScrollListener(this);
    

    @Override public void onScrollStateChanged(AbsListView view, int scrollState) { this.currentScrollState = scrollState; this.isScrollCompleted();//the method to detect scroll completion }

    @Override
    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        this.currentFirstVisibleItem = firstVisibleItem;
        this.currentVisibleItemCount = visibleItemCount;
        this.totalItemCount = totalItemCount;
    }
    
       /***By this methos I detect if there's been a scroll which has completed***/
    private void isScrollCompleted() {
        if (this.currentVisibleItemCount > 0 && this.currentScrollState == SCROLL_STATE_IDLE && this.totalItemCount == (currentFirstVisibleItem + currentVisibleItemCount)) {
     
            if(canLoad) { //class variables to manipulate the data
                pageNumber =pageNumber +1;
                refreshScreen();
            }
        }
    }
    

    }

    opened by arinjaypatni-infy 1
  • java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference

    java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference

    App crashes, Reason: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference

    java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference at com.example.libs.stickyheader.HeaderListView$HeaderListViewOnScrollListener.onScroll(HeaderListView.java:218) at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1950) at android.widget.AbsListView.trackMotionScroll(AbsListView.java:7165) at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:6587) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777) at android.view.Choreographer.doCallbacks(Choreographer.java:590) at android.view.Choreographer.doFrame(Choreographer.java:559) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6891) 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:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

    opened by navnit 0
  • Demo crashing - patched

    Demo crashing - patched

    I just put in a patch for this issue in the Demo. There was a problem where views would be recycled, but they were for the wrong type of view. The issue caused a null reference to be returned for R.id.text2when recycling a convertView that had originally been a TextView.

    opened by pcholt 1
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
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
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
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
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
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 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 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
android custom listview,with interaction pattern load more and pull to refresh to load data dinamically

The first thing that i have to say is render thanks to johannilsson because all the part of pull to refresh listview is based in the code of his repos

Fabian Leon 447 Nov 15, 2022
Awesome Listview filter functionality in Android.

About Awesome Listview filter functionality in Android. See it in Action: https://www.youtube.com/watch?v=RO54U1ES5CA Listview with beautiful transpar

Bhavya  Mehta 446 Nov 20, 2022
Bringing extended scrolling features to Android's native ListView and ExpandableListView.

About QuickScroll QuickScroll is a library aimed at creating similar scrolling experiences to the native Contacts app's People view. It has the same s

Andras Kindler 461 Nov 11, 2022
Simple ListView based Android AccordionView

Android Accordion View Example git pull import to eclipse properties->android uncheck is library run as android application See main.xml. Screenshot L

Maciej Lopacinski 164 Nov 28, 2022
Android ListView that implements the QuickReturn UI pattern. Written from scratch with focus on performance.

QuickReturn Android ListView that implements the QuickReturn UI pattern. Written from scratch with focus on performance. Demo Usage In your build.grad

Felipe Lima 191 Nov 25, 2022
AssignmentListView is an Android ListView widget which calculate image loading times.

AssignmentListView is an Android ListView widget which calculate image loading times.

null 5 Sep 9, 2022
[] A swipe menu for ListView.

SwipeMenuListView A swipe menu for ListView. Demo Usage Add dependency dependencies { compile 'com.baoyz.swipemenulistview:library:1.3.0' } Step 1

星一 3.5k Dec 16, 2022
Android library to observe scroll events on scrollable views.

Android-ObservableScrollView Android library to observe scroll events on scrollable views. It's easy to interact with the Toolbar introduced in Androi

Soichiro Kashima 9.6k Dec 30, 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