How to make a scroll able list of check boxes? - android

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

Related

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 implement sectioned listview like in youtube app Android

Does someone know to implement this kind of views structure in Android ? It's from youtube app.
Thanks for your help.
Android have a great little tool when you want to know how something was done.
It's the DDMS (device monitor), look around on Eclipse or Android Studio that you can find it.
Over there, you will find the option: "Dump View hierarchy for UIAutomator" and you can use it to get the View hierarchy of different apps. So for example YouTube:
You can see that it's just a normal ListView with a very cleverly built Adapter. Check out carefully the BaseAdapter class https://developer.android.com/reference/android/widget/BaseAdapter.html
specially two methods:
int getViewTypeCount();
int getItemViewType(int position);
those can be used to have different types of view depending on the position of the ListView. So then it's just built one-by-one, the types you want to implement.
The "more" will do nothing more than add more items the data backing the adapter and call notifyDataSetChanged()
happy coding...
You would need to create more than 1 listview and use padding around it to create the space between one listview and another. You also need to make the layout where the listviews are setup scrollable.
I would personally setup a fragment for each listview to be able to load more data in each list.
Hope this helps. :)

Android list of boxes

I wonder if there is a tutorial or example code how the effect below achieved in Android, or if someone published an adapter already for this... Basically based on the number of results returned the screen is populated with boxes, and as the finger swipes down more boxes will load on demand until the results run out.
This is a GridView. And you can use your custom Load More GridView. This is a custom ListView example of the same. You can implement your own custom GridView similar to this.
What you are looking for is a Lazy List Adapter.
There is a great implementation for it. You can check it here. All what you need next is to create the layout of your list rows, i.e the boxes.

ListItem click and checkbox click at the same time

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.

Expanding List? (android)

So i want to make a list that has a number of items on the list but when a item is clicked i would like it to expand in the list to revile more information
i have done something similar with java script before but searching google isnt helping me :(
Does any one know a way i can achieve this or will i be stuck using multiple pages.
I think you are looking for Expandable listView. You can check the example here
Hope this may help u..

Categories

Resources