Layouts

Defining the visual structure of your Xamarin.Android app

PDF for offline use

Let us know how you feel about this

Translation Quality


0/250

last updated: 2017-08

Layouts are used to arrange the elements that make up the UI interface of a screen (such as an Activity). The following sections explain how to use the most commonly-used layouts in Xamarin.Android apps.

  • LinearLayout is a view group that displays child view elements in a linear direction, either vertically or horizontally.

    Example Linear Layout

  • RelativeLayout is view group that displays child view elements in a relative position. The position of a view can be specified as relative to sibling elements.

    Example Relative Layout

  • TableLayout is a view group that displays child view elements in rows and columns.

    Example Table Layout

  • RecyclerView is a UI element that displays a collection of items in a list or a grid, enabling the user to scroll through the collection.

    Example Recycler View

  • ListView is a view group that creates a list of scrollable items. The list items are automatically inserted into the list using a list adapter. The ListView is an important UI component of Android applications because it is used everywhere from short lists of menu options to long lists of contacts or internet favorites. It provides a simple way to present a scrolling list of rows that can either be formatted with a built-in style or customized extensively. A ListView instance requires an Adapter to feed it with data contained in row views.

    Example List View

  • GridView is a UI element that displays items in a two-dimensional grid that can be scrolled.

    Example Grid View

  • GridLayout is a view group that supports laying out views in a 2D grid, similar to an HTML table.

    Example Grid Layout

  • Tabbed Layouts are a popular user interface pattern in mobile applications because of their simplicity and usability. They provide a consistent, easy way to navigate between various screens in an application.

    Example Tabbed Layout

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.