Question

I'm building an sms app, and need to show the view according to Incoming/Outgoing sms. I'm facing the following issue, in my getView(..) I need to know if it's Incoming/Outgoing and then to show the following:

Incoming VIEW

Incoming VIEW

Outgoing VIEW

enter image description here

But i can't think of a way to implement 1 view to handle this (because of the recycling in listview).

I thought of using setLayoutDirection in a LinearLayout, or maybe removeViews and then add them in correct position. Can you please assist me with the best way with the less performance?

Thanks very much

Was it helpful?

Solution

You can override the getViewType method in order to precise how many kind of rows you listview has.

Have a look here.

OTHER TIPS

Here is a simple example how to achieve it with good performance: http://adilsoomro.blogspot.fi/2012/12/android-listview-with-speech-bubble.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top