The smart layout algorithm used by list view