Extract a layout function for the views.