i'm trying to create an activity that looks similar to this (circled in red):
I'm wondering if they're using a Listview to do this?
I also am wondering, how did they do the "reminders" section where it expands and retracts based on how many reminders you put in.
Thanks
I'm wondering if they're using a Listview to do this?
Unlikely. That is probably a GridLayout, perhaps wrapped in a ScrollView.
I also am wondering, how did they do the "reminders" section where it expands and retracts based on how many reminders you put in.
Add more children to the GridLayout in the appropriate positions.
Related
I'm doing a reminder application for Android that has an activity which is populated with inputs that depend on the category of the reminder. The amount of inputs (EditText) changes depending on the category, so im a little confused on how to tackle this case.
I propose 3 solutions here, but I'm not sure if there is a 4th solution or a better way to do it. I'm open to criticism. These are my choices:
I can make fragments for each category
Or I can make a common xml layout file that contains a number of inputs that reflect the category with most inputs, and find them programatically and assign them their properties
Or I can make the inputs programatically.
I'm trying to find the most elegant solution here. Thank you for your help.
What you can do is write all the inputs in one file,then set their visibility to hidden, and only programmatically change the visibility to show when you want it to. Tht way if you want to show three inputs, you can change the viibility of the three inputs and the rest of them would still be hidden, hence solving the issue.
Use some kind of adapter-based View. I recommend RecyclerView.
With it, you can covert your form objects into scalable View hierarchies in an elegant, efficient View, using an Adapter object.
You can use <include> to add your different screens and assign the visibility programatically
I am developing an activity with a ListView in which I need to change the current row by another layout by clicking on the row, and I'm not finding any way to do as much as I look (I take hours searching for possible solutions and I have not seen any reference to this problem). I do not know if this can be done in Android, but if anyone has an idea of how to do this would be appreciated.
Thanks in advance.
PS: The ListView control is normal and just want to replace a layout with a different layout. I'm using the API 15.
Use a ViewSwitcher
http://developer.android.com/reference/android/widget/ViewSwitcher.html
A ViewSwitcher is -
ViewAnimator that switches between two views, and has a factory from
which these views are created. You can either use the factory to
create the views, or add them yourself. A ViewSwitcher can only have
two child views, of which only one is shown at a time.
I suggest merging the two layouts in a single one and hide the second one. In your adapter data you should have a flag or something to indicate which layout to display. When you click a row, toggle that flag for the selected item and notifyDataSetChanged() on the adapter. This will make sure the changed layout remains even if you scroll up and down and the row goes off screen.
A more optimized solution is to have different item types in the adapter.
I'm looking to create a music app and I'd like to make a GridView similar to what Google Play uses where they inject elements that will span rows and columns like the Soilwork album does in this screenshot:
I've thought about using a ListView and populating rows with custom elements, but I couldn't think of a good way to use that with ViewHolder pattern, or really a way to make that reusable and account for differing number of items in width based on screen size (for example, the grid is only two items wide on phones, and "large" items span both columns and only one row).
I've also thought about using a ScrollView filled with custom ViewGroups, but that seems to run into the same issues I previously mentioned.
I next thought about using GridLayout, but that doesn't accept ListAdapters, and doesn't seem tuned to the kind of usage I'm looking at (nor does it seem to scroll)
I'd greatly appreciate if anyone could give me somewhere to start on this, or could point me to a library that does this. I've already checked out StaggeredGridView but it doesn't seem to accomplish what I'd like. My ideal solution would be a view which lays out items on an even grid like GridView and accepts view from a ListAdapter, also like GridView, but allow for elements to span, using the single cell constraint of GridView as the default behaviour.
Cheers.
EDIT
I have a perfectly functioning GridView as shown below, but I'd like to make items at regular intervals (every nth item) span more than one column and/or row, as shown in the previous screenshot.
Check out Parchment. GridDefinitionView may help you achieve the UI you are looking to build.
I'm building a contacts app and wanted to know what the best way of building something like the image below(Jessica is not too shabby...) in terms of using a list view, scrollview, etc.
Ideally, all of my data is in the sql database so a cursor adapter wouldn't be an issue. Is it better to have a listview with separators, or a scrollview where you add views. Since all contacts won't have exactly the same information, what can we do to make that? Any ideas would be greatly appreciated.
If you plan to have interactive elements inside of the items (e.g. the message button in the screenshot above) I'd recommend a ScrollView. Actually, since you probably don't have that many items I would again recommend a ScrollView. Then it's justa matter of having a set of layouts that you dynamically add depending on the information you have for the contact.
I am trying to produce an activity with an interface somewhat like that of the 'add contact' activity in the standard people application - ie something with a number of lists (email addresses, phone numbers, etc) each of which has a variable number of entries and an 'add' button. The lists themselves don't scroll (ie all entries are shown all of the time), but the overall interface does scroll.
My first attempt uses several listviews inside a linearlayout inside a scrollview; the code adds elements to the listviews as required. However, I cannot find a way to prevent the lists from being scrolled, rather than being shown full length.
Can anyone suggest how I might stop the listviews from scrolling ? Or perhaps suggest a better container than the listview (I don't want to re-invent the wheel) ?
Thanks,
Richard
Have you considered using table view instead? It should be possible to make rows clickable. Here is how to create table rows in code in my other answer:
How to populate the TableLayout with ImageView dynamically in android jdk?
Maybe ExpandableListView will be more helpfull here. http://developer.android.com/reference/android/widget/ExpandableListView.html for more info
The lists themselves don't scroll (ie all entries are shown all of the time), but the overall interface does scroll.
This is incorrect. All entries are not shown all of the time.
My first attempt uses several listviews inside a linearlayout inside a scrollview
You cannot put a ListView in a ScrollView.
Or perhaps suggest a better container than the listview (I don't want to re-invent the wheel) ?
The add-a-contact activity uses a ScrollView wrapped around a LinearLayout holding each of the "editors".