Android Quick Tip
Often times you’ll want to tile, or repeat, a small image as the background of an Android view or layout. This is just like using the ‘background-image’ and ‘background-repeat’ CSS options, and almost as easy. First and most importantly, you’ll need an image to tile. If you don’t have one of your own, use the one below (right click and “Save Image”).
Now, in your project’s res/drawable path, create a file named tile_background.xml. Fill the file with the following XML:
1 2 3 4 5 6
Now all you have to do is set the android:background attribute of your target view or layout to the tile_background.xml drawable id, like so:
1 2 3 4 5 6 7 8 9
And if sample_layout.xml was the assigned content view for your main activity, you would see this when you started your app: