I want to create a bookshelf that tiles horizontally and vertically. I have three images, ShelfLeft, ShelfMid, and ShelfRight. ShelfLeft starts each row/shelf, followed by X ShelfMids across the screen, capped off by ShelfRight at the end of each row.
There will be a default of 5 rows, and if more are needed, they shall be able to be added dynamically.
What is the best way to go about doing this?
Thanks.
I’d use a
TableLayout. Use a cell for each of the “ends”, and then another single cell for the tiled background.To make a background repeat, create res/drawable/my_background.xml:
Then reference this as the background in your layout by specifying `android:background=”@drawable/my_background”.
(Source: http://androidblogger.blogspot.com/2009/01/how-to-have-tiled-background-cont.html)
Also worth noting: You might find the
NinePatchclass useful when creating your “ends”.