Which layout to use to show conversations? - android

If I want to show messages in a threaded conversation, which layout should I use? A linear layout with text views or a list view? Or something else?

Even i suggest you to go with ListView as the number of conservation increase in listview the customadapter i.e., android take care about show few list item while scrolling.
if you use LinearLayout or any other layout then then you will run into problems as the number of conservation increases
Here is the LINK for a sample example to implement

I suggest you to use a ListView with a ListAdapter or a CursorAdapter if reading from a database (more efficient), a useful post:
Is there a super simple List / ListAdapter example out there for android

Related

Android Customizable Expandable List View Item

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.

How to create the layout for this kind of activity?

How can I display information in the following format? What controls should I use, listView or RecycleView?
Note that the question isn't about this particular activity and how to use it. It's about how to show the information in the same format and how to create the layout for it.
That is a ListView. You would just need a ListAdapter/ArrayAdapter to fill it and that's about it.
You can make exactly the same thing using the layout simple_expandable_list_item_2 in the SimpleAdapter of a ListAdapter (here is how you do it : Displaying kind of static data in ListView)
RecyclerView is of course much better in terms of performance and flexibility. However, ListView is enough in many cases like this one.

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.

Android - How to structure a layout that has two dynamic texts and then a list

I am trying to create a screen where I get two items from SharedPreferences and display them to the screen, and then display a list via an adapter.
What I am not sure about is how to structure the layout xml file for this. Any suggestions how to do that?
Thanks!
You can have the main layout with a listview. Then you can have a sub layout for each row of your list. This row layout, let's call it row_layout.xml may have two text areas if your items are text or it may have a text area and a checkbox button if that's what you want. Basically, whatever you want to display in a single row of your list.
Read up a tutorial, here's one: http://www.vogella.de/articles/AndroidListView/article.html
Take a look # MergeAdapter, you can also create a view only listitem and add these item as header to the list
I am not sure what you mean. Are you asking for examples of layouts with two textviews that can be updated via sharedprefs, with a ListView in the activity? Or just suggestions? An easy way to get started would be to use the Eclipse Android plugin that has a layout designer in it. Here is a tutorial on how to use it http://mobile.tutsplus.com/tutorials/android/android-layout/ Its pretty easy and straight forward.

Efficiency of Listview with the flexibility of the ScrollView

I am trying to figure out the best approach for a particular UI for a particular data capture application, where I have a bunch of form widgets (EditText's and Spinner's) at the top of a vertical scrolling view, then a number of checked entries (10-200), and then a number of additional widgets at the end.
I am trying to think of the best way to get utilise the efficiency of the ListView (with the view recycling and option of the custom adapter for the checked entries), but the flexibility to include the other widgets before and after the list.
I have eliminated the idea of putting a ListView inside a Scrollview, for the well documented reasons.
I have also considered breaking it into multiple views and using the ViewFlipper, but this does not flow as well for the user experience.
The only other idea I have encountered is to put my non-listview items in as the Listview header and footer. This way I can still use my custom adapter for the listview checked entries, and the rest of the widgets are where I want.
Does this sound like the most efficient and sensible approach? Any comments and advice appreciated.
I have a custom listview with widgets above and below it in my app. ListView without ListActivity
Just put the listview in it's own LinearLayout and it should work perfectly.

Categories

Resources