![]() ![]() ![]() ![]() The tools:context=".MainActivity" is declaring which activity is associated with this XML file by default. You can see that we set the width and height on ConstraintLayout to match_parent meaning it is set to the whole screen. android, app and tools are all namespaces and the URIs that they are set to equal the resources that they have access to. The xmlns: stands for xml-namespace and it is how we define resources to certain namespaces. A ConstraintLayout is just a container that allows us extra customization, however, we don't actually use this customization. If you are unfamiliar with all these weird names, let me give you a little rundown. This is our main activity, the main activity gets automatically created for us.Now that we both have a solid understanding of what a RecyclerView is, lets move on.Įnter fullscreen mode Exit fullscreen mode So anytime we talk about a method being called, it is the RecyclerView library that is doing it. All we have to do is supply the data and define how the individual item looks and the RecyclerView 'LIBRARY'(not the class) dynamically creates the elements when they are needed. What makes a RecyclerView special is that it easily and effectively displays large sets of data. Basically a RecyclerView is just a view, no different than any other view, so we can add it in an XML file. Before we go any further I need to make sure that we are on the same page when it comes to understanding what a RecyclerView is.For each of the four steps I will paste the appropriate code and then we will walk through it line by line.XML fileĢ) Create the individual ViewHolder item.Ĥ) Initializing everything inside of the Activity When implementing a RecyclerView inside of an activity there are 4 main steps you have to follow.ġ) Add the RecyclerView to the activity's.With that being said lets just jump into it. All the resources I used to create this post can be found on ticketnote or HERE. Join me and let us try to build and understand some cool stuff. This series is going to be dedicated to the basic to Android development. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |