Updating the Layout

Figure 8.1 shows what CrimeFragment’s view will look like by the end of this chapter.

Figure 8.1  CriminalIntent, episode 2

CriminalIntent, episode 2

To get this on screen, you are going to add four widgets to CrimeFragment’s layout: two TextView widgets, a Button, and a CheckBox.

Open fragment_crime.xml and make the changes shown in Listing 8.3. You may get errors from missing string resources; you will create them in a moment.

Listing 8.3  Adding new widgets (fragment_crime.xml)

<​?​x​m​l​ ​v​e​r​s​i​o​n​=​"​1​.​0​"​ ​e​n​c​o​d​i​n​g​=​"​u​t​f​-​8​"​?​>​ <​L​i​n​e​a​r​L​a​y​o​u​t​ ​x​m​l​n​s​:​a​n​d​r​o​i​d​=​"​h​t​t​p​:​/​/​s​c​h​e​m​a​s​.​a​n​d​r​o​i​d​.​c​o​m​/​a​p​k​/​r​e​s​/​a​n​d​r​o​i​d​"​ ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.