O'Reilly logo

Android Programming: The Big Nerd Ranch Guide by Brian Hardy, Bill Phillips

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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​"​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required