Android Programming The Big Nerd Ranch Guide, 3rd Edition

(Brent) #1

Chapter 9  Creating User Interfaces with Layouts and Widgets


184

Using ConstraintLayout


Now, convert list_item_crime.xml to use a ConstraintLayout. Right-click on your root
LinearLayout in the component tree and select Convert LinearLayout to ConstraintLayout (Figure 9.5).


Figure 9.5  Converting the root view to a ConstraintLayout


Android Studio will ask you in a pop-up how aggressive you would like this conversion process to be
(Figure 9.6). Since list_item_crime is a simple layout file, there is not much that Android Studio can
optimize. Leave the default values checked and select OK.


Figure 9.6  Converting with the default configuration

Free download pdf