Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do Google use Canvas in the Gmail app conversation list view?

I've been inspecting the Gmail app in Android using the HierarchyViewer and found something interesting in that each item in the email list looks like a canvas view - I was expecting something like a RelativeLayout with child components: Screenshot of Gmail conversation list in HierarchyViewer

My initial though is that it's done this way for performance reasons - one canvas view per item is much better than multiple views per item, especially in a long list which seems to scroll very smoothly. Does this sound correct? Do Google recommend this approach anywhere in their official documentation? Is it an approach that other people should look at for performance?

like image 455
Martyn Avatar asked Nov 03 '11 10:11

Martyn


1 Answers

Yes the fewer views the more efficient the UI is. If you have a visually complicated UI element it can be much more efficient to implement it as a custom view or layout rather than trying to compose individual views.

like image 82
hackbod Avatar answered Oct 23 '22 01:10

hackbod