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.
Related
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. :)
I am new to android development and I am making a recipe app. All seems to be going well but on the submit a recipe page I was hoping to but a box of checkboxes. For example, I would have a box taking up a third of the page that you could scroll through a check ingredients' checkboxes as needed. Is there any way to implement this? I am struggling massively on it. Thanking you!
Use List & Adapter.
A custom layout for adapter would fit your need.
Check this great tutor:
http://www.vogella.com/tutorials/AndroidListView/article.html#tutorial_ownadapter
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
I've been trying many things with list items and i'm facing some problems. In my previous question, thanks to #nEx.Software i was able to resolve the problem. But I'm still missing some concepts here.
Right now i'm trying to differentiate between an item's click and a checkbox within it. However, I want to do it without extending the array adapter. Is there a way to use both methods: listView.onItemClickListener() AND listView.getCheckedItemPositions(), together!
There should be a way to use an xml file [doesn't matter how complex it gets] along with extending the available Views and this thing should be done.
Putting it simple, open the gmail app, and u'll find all emails listed with checkboxes where u can click on the checkbox to mark it OR the rest of the item to open the email.
Again, I know that it is doable with extending Adapters and adding an Array for the checkboxes, but, is it possible to use the convenient methods: listView.onItemClickListener() AND listView.getCheckedItemPositions()? is CheckedTextView a part of the solution?
One more thing, rather than just answering me [where i become lazy]
Wheather it is possible or not, is there a verry reliable reference for such issues? I would really like to fully understand everything that goes into this matter... if its not possible, i must be able to tell why!
Thank you :)
add custom row into your listview. into your custom row you add one textview and checkbox into linerlayout and get linerlayout click event.
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