user345602
user345602

Reputation: 598

Android rotate control

How to rotate control (checkbox) in 180 or 90 degrees ?

Upvotes: 1

Views: 1875

Answers (1)

Daniel Waechter
Daniel Waechter

Reputation: 2763

One way is roughly the same as in this question:

public class CheckBox90 extends CheckBox {
    public CheckBox90(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        canvas.rotate(90,20,20);
        super.onDraw(canvas);
    }
}

...but that's kind of hacky. Probably better to do it this way. Grab the checkbox images, rotate them in the image editor of your choice, then tell Android to use the rotated versions.

Upvotes: 3

Related Questions