开发者

Rotate button in onDraw()

开发者 https://www.devze.com 2023-03-04 19:37 出处:网络
I\'ve tried it this way but this doesn\'t work. What am I doing wrong? RotateButton sdb = (RotateButton) findViewById(R.id.slideDown);

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();
    }


}
0

精彩评论

暂无评论...
验证码 换一张
取 消