Positioning item layouts
To keep the interface clean, we will create a very simple item for our recycler view list. It will contain just an image, a string, and an action button for the user to add the ingredient to their sandwich.
The initial item layout will look like this:
This may appear to be a very simple layout, but there is more to it than meets the eye. Here is the code for the three views:
The image:
<ImageView android:id="@+id/item_image" android:layout_width="@dimen/item_image_size" android:layout_height="@dimen/item_image_size" android:layout_gravity="center_vertical|end" android:layout_margin="@dimen/item_image_margin" android:scaleType="fitXY" android:src="@drawable/placeholder" />
The title:
<TextView android:id="@+id/item_name" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android...