is there a way to have 2 gradients in a drawable xml using either a <layer-list> or <shape> or some combination of them?
2 Answers
Based on your clarification in Roman Nurik's response, I think what you're looking for is centerColor.
<gradient startColor="#00FF00" centerColor="#FFFF00" endColor="#FFFFFF"></gradient>
2 Comments
android developer
what if we want to have more than 3 colors?
Phantômaxx
No, you can't have more than 3 colors in a single gradient.
I don't see why not... a layer list drawable that references two shape drawables sounds like it would work. Have you tried that?
2 Comments
Ben
yeah i did, it works except for one thing: there's no way to make the gradients go from 0-50% and 50% - 100% of the drawable. they only allow for absolute values.... which sucks.
Roman Nurik
Ah, I'd update the original question to be something like "how do I create gradients that have intermediate color steps." That sounds a little more clear than the original question :)