I'm trying to design a page for my app that will be a list of places. I need each list entry to have a picture, text below, short description, and some other info, address
The list view fragment examples that I've seen simply have one or two lines which won't really do what I need it to... where do go from here? I'm not sure what to search for, nothing useful has come up so far..
You are going to need to make a custom ArrayAdapter.
Check out some of these examples:
Android Custom Listview with Image and Text using ArrayAdapter
Android Custom ListView with Images and Text – Example
Customizing Android ListView Items with Custom ArrayAdapter
Related
I display my JSON data into a RecyclerView. I have multiple TextView into one item and it works perfectly.
In my data, I need to fetch photos and display them into each item. I have multiple photos for one item. It starts from 6 photos to... many more.
I tried using a RecyclerView inside my first RecyclerView but as you can guess it was a bad idea (bad performance, not the good result expected and so on).
Do you have any other solution or advice that might help, please?
I found a thousand solutions how to display one picture by row but none about multiple pictures into one row.
Create a custom view and add Image views dynamically based on no.of views required.
Use this view in the recycler view adapter itemlayout file.
I want to create some kind of ListView which will be expanding and collapsing after click on one of its item. When item of ListView is expanded show additional data. After I click another one first data collapsing and show actual one. I found one solution (https://github.com/SilenceDut/ExpandableLayout) but I'm thinking that should be other ways to do that without using external library. Am I right ?
P.S sorry for weak english
You can do it using Expandable List View:
Tutorial Link :-http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/
is it possible to make an expandable list within an expandable list
i am making a recipe application and i've three expandable lists of the same type - vitamins, minerals and macro-nutrients created with expandablelistview with android studio
is it possible to put these three expandable lists under an expandable list called nutrition and if so could you briefly outline how please. thanks in advance
Short answer, yeah you can but you really really shouldn't.
I've tried this before and it didn't end well, I can't remember the exact reasons but conflicts arise between touch listeners and the measure passes when trying to layout the views inside the different adapters don't calculate correctly.
You can find a number of custom ExpandableLists trying to do what you want around the web but I found they also had similar issues.
What I ended up doing was building my own expandable listview. If you check the source code for Android's ExpandableListView and ExpandableListAdapter you'll find that it's basically
just a regular listview
a list of items that are visible
an Async filter for the data source
some meta data to tell if its a child or group, expanded or collapsed, etc
So if all your item are collapsed the visible list only contains the Group Items.
Expand a Group Item and the async filter gets triggered and populates the visible list with the Group Items and the Children of the expanded Group Item.
Depending on the meta data it will call either getGroupView or getChildView.
So if you want you can take a shot at writing your own.
I wrote a blog post for an ExpandableList that I wrote that does, in theory, infinite levels of expansion. NLevelExpandableListView
To clarify this - what I want to do is:
a) to open a http request to obtain some XML
b) parse that XML
c) given the (fixed) number of elements, put them with a bucle in the layout.
What I am missing is the last part. An example is 'twicca' or just the official Twitter application, that fills the layout with tweets. I want to do something like that. How should I proceed?
My first thought was creating a fixed number of TextView and change those TextView (TextView1, TextView2, ...) with the content I wish. But that doesn't sound very professional...
The standard way to do this in Android is with a ListView (link to developer guide), which automatically creates as many items as needed from the data source. Most examples show pulling from a local SQLite database, but after you've loaded your XML items into an array in memory you can use an ArrayAdapter as the data source for the ListView.
Im trying to make an android-app that shows a list of albums and it displays the album-title on each listitem. So far so good.
But I would also need the album-id somehow connected to each listitem to use when I get the next level to list (the album-tracks). How can I in each list item store more values for the items then the displayed text (album-title)?
Right now Im using an ArrayList (to store the album-titles) that is connected to a ArrayAdapter wich use the simple_list_item_1 layout. I get the album-info (title, artist, id) form external xml.
I was thinking on using a multidimensional array but I don't know how to connect it to the ArrayAdapter since it only is expecting an array?
Any suggestions on how I should tackle this?
Instead of using simple list adapter you should use android custom list view.
Check out this link
Hope this will help you.
try Android sample demo project
http://developer.android.com/resources/tutorials/views/hello-gridview.html
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/index.html