Search⌘ K

Building Layout

Explore how to build a functional list screen layout for an Android travel blog app. This lesson guides you through creating item layouts with LinearLayout, ImageView, and TextView, then integrating them using RecyclerView and MaterialToolbar for a polished interface.

Final result preview

To make it easier to understand what we want to achieve, here is a preview of the layout that we are going to build.

List item layout

Let’s start by creating a list item that is going to be a separate layout file.

Create a new item_main.xml layout file inside the app/src/main/res/layout folder. As a root layout, we are going to use the LinearLayout, which displays its children either horizontally or vertically depending on the orientation attribute value.

XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="16dp">
...
</LinearLayout>

Next, let’s add the ImageView to ...