How to create gradient for button in android through java code? By James | November 18, 2011 1 Comment In the previous post I have showed how to create gradient buttons in android using XML. This is how we do this in java code. This is another method of applying gradiant. Please leave your valuable comments.