‫Hello, my friends, and welcome back.
‫In this video, we'll start building our application.
‫But I want from you to focus with me and write down the notes.
‫Follow me step by step.
‫In order to create the recycler view, the first step is the item layout, an XML layout representing
‫the layout of a single item in the recycler view.
‫Let's jump into Android studio, creating the project and then designing the item layout.
‫Open Android studio.
‫Create a new project, select empty Views activity and name it as market app.
‫Select Java Click Finish.
‫I'll create a new layout.
‫I'll name it as item underscore layout, click okay, go split mode.
‫I'll create one image view and two text views in this layout.
‫I'm just specifying the source in order to set and see it in designing mode.
‫I'll drag and drop.
‫I'll add the constraint from above and constraint from the left.
‫I'll add margin 16 and margin from the top.
‫Let's create the two text views.
‫And I'll drag and drop it here and infer the constraints.
‫Then the third view, which is the text view.
‫I'll add the constraints to this with the title.
‫From the left and from above with the title and the 12 below the title.
‫And this is our layout for the item.
‫The second step in creating the recycler view is the recycler view itself, creating a recycler view
‫in the activity and initializing it.
‫Let's go to the main activity.
‫Go split mode.
‫Remove this text view and here I'll add an image view at first.
‫And this image view will act as a header for our application.
‫I'll copy and paste these assets in the drawable folder.
‫Click.
‫Okay.
‫Make sure they start with small letters and no numbers.
‫And I need to display this header here in the image view.
‫So I'll set src equal drawable slash header.
‫I need to increase its size to 240 and 240 is good.
‫I'll decrease its size 2030, which is good.
‫And you can see there is no spaces.
‫Click on it, infer the constraints.
‫And here we go.
‫This is our header image view.
‫Under the image view I need to create the recycler view type recycler view and you can see android x
‫dot recycler view dot widget dot recycler view hit enter.
‫I need to create it with as matchparent and height as Wrapcontent.
‫You can see this is our recycler view.
‫I'll drag it and I'll add the constraint below the image view and the constraints to the left and constraints
‫to the right.
‫And also for the button.
‫I'll drag and drop it.
‫And to make it more pretty and more professional, I'll add the color of the background of this image
‫to the background of the recycler view and the layout.
‫So here I'll set the ID of the recycler view, recycler view and the background, and I can specify
‫the color directly.
‫This is the color.
‫I used photoshop to get the color and pick the color.
‫I'll copy this and go up and here I can paste the background for the constraint layout so it looks more
‫pretty.
‫I'll add some margins from the top 24 DPI and this is good.