applidium / HeaderListView

Android ListView with sticky headers
http://applidium.com/en/news/headerlistview_for_android/
Other
313 stars 96 forks source link

Section with dynamic rows #33

Closed mitesh-shah closed 9 years ago

mitesh-shah commented 9 years ago

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..!! :)

dimitrireef commented 9 years ago

found myself in same trouble, did you find a solution ?

mitesh-shah commented 9 years ago

In my code, i just wanted 2 rows. So i did following logic

        @Override
        public int numberOfSections() {
            return 2;
        }

        @Override
        public int numberOfRows(int section) {
            if (section == 0) {
                return installedList.size();
            } else {
                return availableList.size();
            }
        }

It will create rows based on the size of list specified. installedList and availableList are ArrayList. Hope this helps.!