Finishing the Layout

Now that you have your styles set up, you can save some serious time. Let’s flesh out the remote control interface to a full, luxurious 12-key version, complete with ten deluxe decimal digits.

Now you need to create a 3 x 4 array of nearly identical buttons. But there’s no need to code them all individually. You can create one row of three buttons and then use it four times. Create a new file called res/layout/button_row.xml and move the row of buttons you have already defined into it.

Listing 24.7  A row of three buttons (layout/button_row.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​"​?​><​T​a​b​l​e​R​o​w​ ​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 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.