In this chapter, you will learn more about layouts and views while adding some style to your list items in the RecyclerView. You will also learn how to use the layout editor to arrange views within a ConstraintLayout. Figure 11.1 shows what CrimeListFragment’s view will look like once you build up your masterpiece.
In previous chapters, you used nested layout hierarchies to arrange your views. For example, the layout/activity_main.xml file you created for GeoQuiz in Chapter 1 nested a LinearLayout within another LinearLayout. This nesting is hard for you and other developers to read and edit. Worse, nesting can degrade your app’s performance. Nested layouts can take a long time for the Android OS to measure and lay out, meaning your users might experience a delay before they see your views onscreen.
Flat, or non-nested, layouts take less time for the OS to measure and lay out. And this is one of the areas where ConstraintLayout really shines. You can create beautifully intricate layouts without using nesting.
Before you start learning about ConstraintLayout, you need to take care of one task: You need a copy of that fancy handcuff image from Figure 11.1 in your project. Open the solutions file (www.bignerdranch.com/android-5e-solutions) and find the solution for this chapter in 11. Creating User Interfaces with Layouts and Views/Solution/CriminalIntent. From the app/src/main/res/drawable directory, copy the ic_solved.xml file into the drawable/ folder in your project.
3.145.78.232