Implement a ListView with dynamic section - android

Does anyone have any suggestion or Open Source project to implement a ListView like the following image? I don't even know how to call it, to do a nice search (Searching for ListView with dynamic sections I found this).

The image in question is of an Expandable List View (which is a built-in view). Expandable list views allow you to style the groups and children differently and handles expanding/contracting the groups.
Look at http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/ and http://developer.android.com/reference/android/widget/ExpandableListView.html for more information

Related

Android Customizable Expandable List View Item

My problem is simple: I need to make a layout similar to android.R.layout.simple_expandable_list_item_1 which can fit more than one textview in the layout, as well as show the little '>' symbol that indicates that the tab is expandable.
How can this best be accomplished? My first thought was to use the layout as a background of a linear layout with two textviews in it, but I can't seem to make that work.
Vogella has a pretty good tutorial on how to achieve custom list views through Adapters.
Basically, what you do is you create a Layout with the looks you want for the list items and then you extend an adapter (ArrayAdapter for instance), see section 4. Then, in your activity, you create an instance of your Adapter implementation and populate it from an Array containing the data for the list.
Also have a look at the Developers site for how to make the list scroll smoothly with the ViewHolder pattern.
And if you feel you need more info on the expandable part maybe the hive can help.

Android List view row move vertical

I want to create List view row animation like below . I want to move row from one list view to other list view. Both list view are in same activity.
Anyone can give me idea how I can do this.
First of all because you mentioned "ListView":
In my opinion the best way to perform dynamic "lists" in android is to use to android-given class
RecyclerView.
It's easy to use like a normal ListView but like I said before it handles dynamic data.
Moreover it has some support librarys like ItemTouchHelper to drag/drop and swipe items in the list around. Its very easy to expand your RecyclerView with this upgrade. Here is a good tutorial:
Tutorial.
I would like to give you two ideas how I would proceed to implement such a list like the example of your post:
1) (Recommended) Search on Github or similar sites for 3rd library parties that already solved this.
2) Use the RecyclerView with the ItemtouchHelper-Upgrade i mentioned above and try to expand it with two lists. When an item is onMove() set the visibility of the first list on GONE and the second on VISIBLE. Now you only have to add the data of your item to the second list and remove it from the first. Then use notifyDataSetChanged() on both lists and your done.
I dont know how difficult it will be to implement it but thats the only way I know how you can do that and how the programmers of your example could have done it.

How to have sections in navigationDrawer

I am trying to make a navigationDrawer in Android v4.0+ to be exactly like in this example in the official documentation of android.
However I do not find any documentation how to achieve this. All I can find is telling me to extend the ListView, but that just sounds weird as it looks like the native android classes should have this kind of functionality.
I think you are looking for "ListView header items". One way to achieve such layout is to let your (custom) adapter know that the items at specific positions (or some other criteria) have to be displayed with different layout and populate a different view for those items in it's getView method.

Android ExpandableListView about arrays

I'm planning to add expandablelistview in my activity. I did some researches on the Internet but none of them fits what I want. I read also that expandablelistview has parent and child elements. What I want to do is that the parent would be the categories let's say it's fruits, then its children are Apple, Lemon, Almonds, etc. I'd like to try that by using arrays, but am not so familiar with List and Hash.. Please give me some snippets of codes to start with.. appreciate any help. Thanks.
Expandable List View is quite easy to implement. You can just easily create two arrays with items that you want to add in the list. For more details and insight into the intricacies of the Expandable ListView you can take a look at this link:
Simple Expandable ListView Example
Also, if you need to create a Custom Expandable ListView, then you can find a good tutorial for that on this link:
Custom Expandable ListView

Expandable list view with forms

I've been asked to make an app that has a very VERY long data input form (we're talking around 50 fields here!). Thats a design constraint and there is absolutely no way for me to work around that.
What I'm trying to do is to display the form in a way thats easier on the user. My idea was to break the form into sections and somehow use an expandable list view to display the form. The list group would be the section name and the list items would be the input forms.
My problem is that since the form can contain different types of input fields (checkboxes, radio buttons, textfields etc) and since I'm new to android programming, I dont really know how to do this. All the online tutorials I can find are about simple uniform expandable lists. Can someone suggest me a good tutorial or an alternative to my idea?
I would look into using ExpandableListView as is, but create your own xml layout file for each list 'child' row, putting the field name and then a text input field for the value into it.
Have alook at this page where the author shows how you can put a 'checkbox' next to each list items row:
http://mylifewithandroid.blogspot.com/2010/12/expandable-list-and-checkboxes.html
You have to use child layout view for achiving this.
follow below link and find the code,Inflating only one text view but u can inflate the complete layout(I personally used that thing in my code).
Expandable list view
What you're going to need to do is extend your BaseExpandableListAdapter and customize it to display all the various layout options. Specifically, it's going to be the getChildView() method that you'll have to do the most work in. Do some searches for customizing or extending the BaseExpandableListAdapter and you should find plenty to go by.
Also, take a look at the example from the SDK:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.html
Edit: Link not available

Categories

Resources