Custom List View With Custom Headers Android - android

I have to make a custom list view with custom header, ( different text in each headers) and different number of items below each header. I have been going through various section indexing examples but I think they are not relevant much to my answer.
Anybody please suggest me a good means to move around such type of list view in android.

This might be a duplicate of Android Listview with sections
There are lots of different ones out there. One example is: http://w2davids.wordpress.com/android-sectioned-headers-in-listviews which uses: http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09
That one allows you to pass in different array adapters for each section so that you can have different layouts for each section's items.
If you were more clear about what the ones you have seen fail to do that you need it would be easier to offer you something you haven't seen.

There has been lot of thread exists on the Stackoverflow, check:
Android Listview with sections
Android ListView section header
How to draw a section header in Android listview just like the Contacts app did ?
But I am not sure these threads has helpful info, but if you want to read, understand and implement ListView with sections then here is one of the great and detailed article given by Cyril: ListView Tips & Tricks #2: Sectioning Your ListView

For a more complex design with sections in list, you should try this very standard library : https://github.com/emilsjolander/StickyListHeaders.
Other alternatives mentionned are great.
I should mention that the only drawback of this library is a poor mavenization and its absence on central.

Try this tutorial..its very nice and simple
http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/

There's a very good library for this. I've used in a project or 2 myself. Check it out:
https://code.google.com/p/android-amazing-listview/

Why can't you use expandable list view?
this link might help you: Android Exandable listview tutorial

Related

Does a grouped RadListView support headers/footers?

I can't find any examples of this and wonder if it's even possible? I know about the group header/group footer, but is it possible to have a single header/footer for an entire ListView that has grouping enabled?
According to the answer from the Telerk forums:
Only the Android RadListView control supports header and footer. You can check this article to see how to set them. The iOS TKListView control does not support header/footer, which means that even with custom renderer this scenario cannot be supported.
For Android, you can achieve that via Custom Renderer, there's the related code snippet in the answer. But for iOS, it seems it's not supported.
And it provide a workaround, which may help you:
The only workaround that comes to my mind for iOS (and for Android with no custom renderer) is to group the items in the list view in a single group and use the group header. Here you can find more information about grouping.

How to fully replace listView/GridView with RecyclerView?

I've noticed that the new RecyclerView class, even though it makes things a bit cleaner, is lacking a lot of functionality that I'm familiar with:
dividers, but this can be solved by looking at this post or this one
"footerDividersEnabled"
"headerDividersEnabled"
"listSelector" , but maybe I should simply set it per view ?
"fastScrollEnabled"
"smoothScrollbar"
"textFilterEnabled"
I've also tried to find out if there is a new way to use the new class with filtering (as done with ListView by implementing Filterable). I couldn't find out if there is such a thing
"tools:listitem" , to show the items on the UI designer.
Those are what I use, but maybe there are others that I missed.
Is there any tutorial or some guidelines of how to replace each of those things?
ok, I think I've found some solutions to what I wrote about:
dividers - the links I've given can probably help (here, here and here).
"footerDividersEnabled" - probably like #1, but even if you don't have it, you could always add a divider to the layout of the footer.
"headerDividersEnabled" - same as #2.
"listSelector" - should be done to the item views .
"fastScrollEnabled" - no solution is available for this, except for this library I've found, which was an answer for my post here.
"smoothScrollbar" - should be a feature request for #5. I think it's already smooth, but I'm not sure.
"textFilterEnabled" - sadly, you need to handle it yourself. create a thread pool of size 1, or manage your own thread (or use AsyncTask, in case the work is relatively short), and let it do the filtering for you.
Filterable - same as #7
"tools:listitem" - not available, but I think you could extend from RecyclerView and add it. You will however have to put some work, as RecyclerView doesn't know how to layout the views.
No tutorials that I know of, but the sources for ListView are public! There's no better way to learn than this... For example: I recently implemented filtering just like ListView does and it work like a charm. Plus, if you do it well, you only need to do it once and can re-apply it everywhere!
I would recommend you go look at some of the library's for the RecyclerView. You can find a lot of library's at https://android-arsenal.com/.
Also you can implement your own functionality in the RecyclerView and the Adapter for the RecyclerView. Just extend the RecyclerView and build on that.
I recommend that you read the source code for the RecyclerView at https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java.

android table with more than one column like iOS collectionView

is there a custom UI element on android that will behave like iOS collection view?
[like a grid view, that is scrollable]
or do I have to make a custom table layout custom cells that behave like columns?
here a shot of a UICollectionView for iOS
is there an example for this?
thanks!
Since the previous answer does not reflect performance issues, such as it does not use recycling (which is important for long lists), here is what you are probably looking for:
GridView if your building blocks are all equal in size
http://developer.android.com/guide/topics/ui/layout/gridview.html
or ListView (and a lot of custom logic) if your building blocks have different sizes/widths
http://developer.android.com/guide/topics/ui/layout/listview.html
I don't know the collection view in iOS, but I guess TableLayout is what you are looking for.
https://developer.android.com/reference/android/widget/TableLayout.html
In API14+ there is GridLayout as well.
https://developer.android.com/reference/android/widget/GridLayout.html
Gridview is best replacement of Collection View of IOS. following URL will solve your problem.
http://developer.android.com/guide/topics/ui/layout/gridview.html
This is old, but the Google team have created a widget used in the IO 2014 app that's perfect. It allows for variable column rows and even headers out of the box.
https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/ui/widget/CollectionView.java
You'd have to dig through the source for how it's used, but it's really easy and great to use.
Nowadays RecyclerView is what you're looking for. GridView and others are considered legacy API now. RecyclerView is able to handle these type of layouts more efficiently.

how to create more than two levels expandablelistview

I want to create a expandablelistview that has more than two levels ,and the data is from the database, which has the id,name,parentid , but the default layout of the expandablelistview component is two levels , so how could i do
You cannot do it using the Expandalble List built in in Android.
You would have to write an adapter of your own. People have done it. I've seen several implementations of file browsers that have multi-layer expandable lists. Some might even have the code available so you could take a peek and see how it was done if you can't figure out how to do it yourself.
EDIT
Found some code. One of these should do the trick for you.
tree-view-list-android extends baseadapter
SO Answer with link to code for using a modified BaseExpandableListViewAdapter.

Custom Updatable ListView - Android Development

As a goal for my first Android application to learn the Android SDK, I am trying to create a simple RSS viewer for a specific url. Disregarding the networking side of the goal, I am having trouble with getting a listView to display a custom layout.
What I'd like to do is have each row of a list view show one of two images(read or unread), followed by some text. I'm not really having a problem, it's more that there aren't any examples that I could find (I might be looking in the wrong place) that covered custom layouts depending on conditions in code.
Any help?
Here is a free excerpt from one of my books that discusses the techniques involved. In a nutshell, you will need to extend your Adapter class (e.g., ArrayAdapter, CursorAdapter) and take direct control over the creation of rows, so you can apply your desired business logic.

Categories

Resources