views:

1555

answers:

2

Hello i have a button i want to put on a 45 degree angle. For some reason i cant get this to work. Can someone please provide code to accomplish this?

+4  A: 

Extend the TextView class and override the onDraw method. Make sure the parent view is large enough to handle the rotated button without clipping it.

@Override
protected void onDraw(Canvas canvas) {
     canvas.save();
     canvas.rotate(45,<appropriate x pivot value>,<appropriate y pivot value>);
     super.onDraw(canvas);
     canvas.restore();

}
Ichorus
Ok that sorta accomplish's what i want. I want the entire view itself to be on a 45 degree angle. Just not the text inside. But thank you for answering my question
Matthew
A: 

Can I put more controls (radiobutton, text...) in View, and then to rotate the View?