I am interested in creating a ListView where each row is marked the way it is done in GMail for 3.0+. This creates a nice separation of the left and right ListFragment.
Other examples include also Google Calendar on 2.3.4 for instance where a color marker is on the left of the ListView.

See the grey vertical divider between the two lists. How does one achive something like this? A bonus would be also the alternating width, but I guess that is only a smaller layout change.
I know I could probably do something like inserting an ImageView in there and then fill it with the color I would like but it seems to me that this is an ugly hack.
Another question would be also if there is a generalized way to combine the two ListView fragments somehow the way the GMail or Mail applications do it.

If you want speed, then the option I would go for is to use a custom View class (e.g. extend
RelativeLayout) for the row container View and override thedispatchDraw(Canvas canvas)method.The
dispatchDrawmethod is called after the View has drawn its own contents and before it draws its children – the children are drawn when you callsuper.dispatchDraw.Use this to do something like
This way you avoid adding any extra views to the hierarchy which means you won’t incur any penalty in the layout or measuring phases. Remember to re-use
PaintandRectobjects if drawing a rectangle rather than creating a new one each time. Similarly if you use a bitmap you should share the same Bitmap instance across all instances of your View rather than loading a new one from your resources each time (this does not mean putting them instaticfields)For the indentation of the items, since in this case the lists don’t seem to be overlapping you could (off the top of my head):
LinearLayoutand set the left padding on this (if the above doesn’t work)As for the overlapping of the Views in the second example, I’ll defer to @commonsware answer.