From the course: Learning Kotlin for Android Development

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Create an adapter layout

Create an adapter layout

From the course: Learning Kotlin for Android Development

Start my 1-month free trial

Create an adapter layout

- [Instructor] For a photo app, we want to display a list of photos. To do that we will use Android's recycler view widget. We will need to create an adaptor for it. In this video, we will create the adapter layout. Now that we've created our API models, we have all the pieces needed for our adapter. First, we'll need a layout file to display a row on the screen, I've created a layout file for us to save time. Right click on the layout folder and select New, Layout Resource File, and give the name photo item, press OK. Press the text tab. Let's open the XML file in the exercise files for the video. Select command + A for all, command + C for copy, let's go back to our layout, select command + A for all command + V to paste in our layout, now we have a layout for displaying an individual photo and information about that photo. This will create a layout with a background image named photo item, this will take the full width and height of the row. The second layout will have text views…

Contents