I've tried it this way but this doesn't work. What am I doing wrong?
RotateButton sdb = (RotateButton) findViewById(R.id.slideDown);
sdb.invalidate(); //rotate
the class:
public class RotateButton extends Button {
public RotateButton (Context context) {
super(context);
}
public RotateButton (Context context, AttributeSet set) {
super(context, set);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.save();
Log.d("temp", "rotating");
canvas.rotate(90);
super.onDraw(canvas);
canvas.restore();
开发者_运维知识库//requestLayout();
}
}
精彩评论