I have gone through other questions as well but couldn't figure out something. I have a well set up RecyclerView.
I m trying this library: https://github.com/AAkira/ExpandableLayout
Now I want the items to be expandable so that they show a TextView which is different for each item.
But I can't figure out how to place itms in XML. Where to place RecyclerView and where the expandable layout? How to setup these things?
Take a look at one of the samples given in the library, it is called 'examplerecyclerview' which I think is the one you need.
These are specific files that you should watch:
RecyclerView Activity and Adapter (Java)
RecyclerView Activity (XML)
RecyclerView List Row (XML)
Related
I would like to know the best approach to create an interface similar to the one in the image. I am using the FirestoreRecyclerAdapter to populate my list. Should I have a TextView for each category an then a RecyclerView under that category? I have multiple view types one for the header an one for items but I would have to know when to add a header in between the items. Also note for my purposes a item can fit multiple categories.
Here's a tutorial for implementing such RecyclerView. You might also consider looking at the github repository as well.
The idea is simple and effective which is described in the tutorial. You need a mother RecyclerView inside a NestedScrollView. The parent RecyclerView will have child RecyclerView holding the items to be shown in each row. Just follow the implementation of the SnapAdapter and the Adapter class for the mother and child RecyclerView respectively.
My problem is simple: I need to make a layout similar to android.R.layout.simple_expandable_list_item_1 which can fit more than one textview in the layout, as well as show the little '>' symbol that indicates that the tab is expandable.
How can this best be accomplished? My first thought was to use the layout as a background of a linear layout with two textviews in it, but I can't seem to make that work.
Vogella has a pretty good tutorial on how to achieve custom list views through Adapters.
Basically, what you do is you create a Layout with the looks you want for the list items and then you extend an adapter (ArrayAdapter for instance), see section 4. Then, in your activity, you create an instance of your Adapter implementation and populate it from an Array containing the data for the list.
Also have a look at the Developers site for how to make the list scroll smoothly with the ViewHolder pattern.
And if you feel you need more info on the expandable part maybe the hive can help.
I am trying to show dynamic list of strings in GridView. Every word will be clickable and can be selected or deselected. I am attaching a screenshot of Flipboard as I want exactly the same functionality.
Please help me to find out the same functionality to be implemeted in my app.
The simplest way and without any external libraries you can use native components Gridview or recyclerview with GridLayoutManager
Follow this steps :
1 - Design your row item it's means the click-able labels in separated xml file.
2 - Create your adapter class to inflate view, show the data and handle clicks.
3- attach adapter to gridview or recyclerview.
And her is example for RecyclerView with GridLayoutManager and other one for Gridview
You can use this or this libraries to do this type of functionality
How can I create a list of CardView(s) like the one in the photo? Do I need a RecyclerView or not?
if you want it to look excactly like it is in the uploaded image then you would need either a listview and an adapter with a cardview layout or a recyclerview and a cardview layout, it is basically the cardview that gives the items that good elevated feeling otherwis the rest is the same, but i suggest you use a recyclerview since google is replacing the traditional listview with all recycler, here is a great tutorial you can use http://code.tutsplus.com/tutorials/getting-started-with-recyclerview-and-cardview-on-android--cms-23465
I am trying to make a recipe ListView for food and I want to add imageViews next to items in my list. How can i do that? Thx.
A ListView item can have it's own custom layout.
You have to create your adapter for the ListView. When you create your adapter you can assign your custom layout.
Note: You will have to implement getView() to property set the image+text.
Here you have a sample: Lazy load of images in ListView
Following this tutorial could be a nice idea for you (mainly the second example).
http://www.mkyong.com/android/android-listview-example/
But anyway, you should Google a little bit before asking such a basic question.