From the course: Android Development Essential Training: Manage Data with Kotlin

Unlock the full course today

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

Add a RecyclerView to a fragment

Add a RecyclerView to a fragment

From the course: Android Development Essential Training: Manage Data with Kotlin

Start my 1-month free trial

Add a RecyclerView to a fragment

- [Instructor] So far, in this course, I've focused on acquiring data, either from a web service or from text files packaged with the app. Now, I'll turn my attention to displaying the data. Android's recycler view component can display structure data, either as a list or a grid. In past courses, I've shown how to use recycler view to display a list. So, in this course, I'll focus on building a grid. In my main fragment, I'll delete this code that's building a list of names and displaying it in a text view, and in the associated layout, I'll delete the text view that's being used to display that text. Then, I'll click on the design tab, and I'll drag in a recycler view component from the palette. With the recycler view selected, go over to the attributes window. Set the layout width and the layout height to match constraint because we're working in a constraint view container. Then, go down to the layout section, and click on each of these four icons, and that will anchor the edges of…

Contents