How do you create a tiled gradient background in Android
How do I make a repeating gradient that stretches to fill the width but has fixed height and repeats in .xml? eg. soft black-white-black alternating lines in the background, 10 lines per screen on a phone.
There are a couple of ways, depending on the exact effect you're looking for.
One way would be to draw the lines yourself as a shape.xml and apply it to your View as a gradient.
Another way would be to pick a png tile pattern from the web site Subtle Patterns and use it as a tile background:
[source]
And for your baseline density, make sure that the number of pixels for the height and the width of your png are divisible by two (preferably 4). And that the gap between the top line of the pattern and the bottom line of the pattern is divisible by two (preferably 4). And use a nine patch to make sure that the pattern can stretch horizontally (but in your case not vertically).
链接地址: http://www.djcxy.com/p/89422.html上一篇: 是否有可能用css3重复渐变创建此模式?
下一篇: 如何在Android中创建平铺渐变背景