How to have a tiled background
I’m still using in my layout definition the same way to define the background, with a androidbackground parameter, with the path to your repeating background ( actually that was the point : having a consistent way for background, let them be tiled or not )
<?xml version=”1.0″ encoding=”utf-8″?>
in my drawable directory, I have a back.png file ( the background I want to tile ), and I create this new backrepeat.xml file :
<?xml version=”1.0″ encoding=”utf-8″?> <bitmap xmlns:android=”http://schemas.android.com/apk/res/android”android:src=”@drawable/back”android:tileMode=”repeat” />
Some points :
* I think my first tries failed because I forgot the ‘xmlns:android’ parameter.
* I tried without the xml version line, and it still works, but I think I will let it be there… Just in case !
* The tilemode can be repeat, mirror, or clamp.
* Although in Java, I could set a different repeat mode for X and Y, I don’t think it is possible in the Xml file. Not that I really care for the moment🙂
That’s all !
Thanks again Romain !
I know it is your job, as a Android engineer, to evangelise and help us, but several times you really helped me, you were quick to answer, with concise and most useful answers…