I would suggest that you take a look at this thread, which discusses a similar issue. Even though the question is regarding a TextView component, Button extends TextView, so it should be trivial to adapt this to a button. The OP of that question eventually settled on the following onDraw()
method:
@Override
public void onDraw(Canvas canvas) {
//This saves off the matrix that the canvas applies to draws, so it can be restored later.
canvas.save();
//now we change the matrix
//We need to rotate around the center of our text
//Otherwise it rotates around the origin, and that's bad.
float py = this.getHeight()/2.0f;
float px = this.getWidth()/2.0f;
canvas.rotate(180, px, py);
//draw the text with the matrix applied.
super.onDraw(canvas);
//restore the old matrix.
canvas.restore();
}
I will also say that I wrote a class which implemented this onDraw()
method and it worked great.