How to make a "expandable" list item in Android - android

I've been trying to teach myself code in Android and have made some good progress, however I've had some difficulties finding information about some stuff I have in mind but can't translate into code, I hope your can help me with that.
The main thing I have no idea how to start with is having expandable menu items. I Made a little graphic example of what I want to do:
Headers List:
So this a scrollable list of headers, each header has some information as is (that's why they're pretty big) like a background image and some informative labels on top. When the header is tapped on then it gets pushed to the top and expands all the item info below. Likewise, when it's tapped again the info retracts and the headers list is shown again.
Also as you can see the Action Bar would be expandable, but this is secondary since I think I can make this one work on my own, however if you have comments about it please tell.
Expandable ActionBar:
Thanks :)

Expandable list view is used to group list data by categories. It has the capability of expanding and collapsing the groups when user touches header.
Here , i suggest you the following links which provides the simplest example of Expandable list view...
http://javapapers.com/android/android-expandable-listview/
http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/
i hop this links will helpful for you...

Related

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.

Create a ListView like view in a ScrollView Android

So I did some research and testing of using a listview in a scrollview, and as a lot of people may know this is supposedly bad to do, since they both scroll. It also means I can't show the complete listview as it will wrap to be smaller.
I have seen places which re change the height of the listview to fix this problem but again most people say that it isn't preferred.
What I would like to know though is what is the preferred way of making a nonscrollable listview like view? Basically I want the exact same as the listview but obviously non scrolled and the height based on its contents. I would prefer to work with the layout in as much XML as possible, and I would like to be able to send my array list to it to view on screen. Unfortunately either my search skills are quite dull, as I haven't been able to find anywhere that really explains the preferred method so I thought I would ask here.
Thanks for your help.
<>Clarification Information
I thought I would put this here in case it will help, first off I basically want to show an image, with a list of comments (each one has an author and a text) below it, the comments themselves are obtained from an array and can change. I want the whole page to be scrollable though so I can either view more comments or go back up to the image.
Using a RecyclerView and an adapter supporting multiple item types you could make a list which shows an image on top and several comments below it. Generally you'd have to check what item corresponds to each position - in your case on position 0 you have an image and in every other position you'd have a comment. Then in your adapter's onCreateViewHolder and onBindViewHolder you would check the item type and handle them differently.
You could take a look at this answer for a short example.
Let me know if you'd need any other details and/ or sample codes to get the idea. :)

Implement a ListView with dynamic section

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

How do I roll out this view in my Android application?

I have a complex ListView involved layout in my Android project that looks something like the picture attached. The layout has a top, fixed part (the meeting details) with TextViews Join, Edit and Delete that are clickable (really listen to onTouch events), with Edit and Delete only showing up for the meeting owner/creator.
There is, however, the ListView part below the fixed part as well, and this part has a number of unknown comments, presumably posted by people who have been invited to the meeting. Anyone whose account has access to this meeting, and who sees this layout can comment on this meeting information layout. However, only comments created by a person have the links Edit or Delete (again, onTouch listeners on those TextViews). In this way, think of this page as the detail page when you click on post in Facebook and you see all the comments posted, but are only able to edit/delete your own comments.
I thought I could set out with a solution like this page, with the top, fixed part and the ListView in the same fragment layout, but that will only work if I have the same links for all the comments. That is not the case for me, because the links Edit and Delete for each comment will only show up if the comment is by the comment author.
How should I do this? Do I have to write my own Adapter? Is that the only way? How would I go about writing my own Adapter? Any pointers/tutorials/links appreciated.
Lastly, I was wondering how I can set listeners for each clickable item on the comments. I know I have to use setTag() and getTag(), but don't know where to do this.
Any help is deeply appreciated.
Vogella.com has some good android tutorials. Here is one for writing a custom adapter. The android docs also have a tutorial on listviews, but it doesn't look like they tell you how to do custom adapters. They do, however, tell you how to handle clicks on the list view.
You can setup your comment view to display the Edit and Delete buttons or not in the getView() method of your BaseAdapter class.

how to create android listview like android google chrome tab

I need to create listview like in this picture. The listview item go over each other like google chrome tabs.. I can move up or down listview item... Could anyone tell me a good advice or tell me examples how should I do this?
Thanks
You need an iOS passbook style component like CardWalletView
You have to create some accordions type control
Here is a link which will help you
http://android-puremvc-ormlite.blogspot.com/2011/07/android-simple-accordion-panel.html
when you close the previous view you will not animate that view to the end you have to keep some margin of 2 to 3 pixels to show view as you want
Another idea is you should create some view and use drag and drop... But also you have to some Math calculation... Try this maybe you can get something
Expanding list views may help you with that. I assume that your list view will essentially expand on click and shift everything below the selected area downwards revealing only the content of that selected tab.
Expanding list views utilize the parent-child methods that would allow you to create a very rough view of what you are showing. Styling and customizing those rough layouts afterwards could very well allow you to get that look you're looking for.
Here are some links that might be useful.
http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/
http://developer.android.com/reference/android/widget/ExpandableListView.html

Categories

Resources