Laying Out the User Interface

Currently, activity_quiz.xml defines the default activity layout. The defaults change frequently, but the XML will look something like Listing 1.1.

Listing 1.1  Default activity layout (activity_quiz.xml)

<​R​e​l​a​t​i​v​e​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​"​ ​ ​ ​ ​x​m​l​n​s​:​t​o​o​l​s​=​"​h​t​t​p​:​/​/​s​c​h​e​m​a​s​.​a​n​d​r​o​i​d​.​c​o​m​/​t​o​o​l​s​"​ ​ ​ ​ ​a​n​d​r​o​i​d​:​l​a​y​o​u​t​_​w​i​d​t​h​=​"​m​a​t​c​h​_​p​a​r​e​n​t​"​ ​ ​ ​ ​a​n​d​r​o​i​d​:​l​a​y​o​u​t​_​h​e​i​g​h​t​=​"​m​a​t​c​h​_​p​a​r​e​n​t​"​ ​ ​ ​ ​a​n​d​r​o​i​d​:​p​a​d​d​i​n​g​L​e​f​t​=​"​@​d​i​m​e​n​/​a​c​t​i​v​i​t​y​_​h​o​r​i​z​o​n​t​a​l​_​m​a​r​g​i​n​"​ ...

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.