1 package com.parrot.ARDrone;
\r
3 import android.content.Context;
\r
4 import android.graphics.Canvas;
\r
5 import android.util.AttributeSet;
\r
6 import android.widget.Button;
\r
8 public class RotatedButton extends Button {
\r
9 public RotatedButton(Context context) {
\r
10 super(context, null);
\r
13 public RotatedButton(Context context, AttributeSet attrs) {
\r
14 super(context, attrs );
\r
17 public RotatedButton(Context context, AttributeSet attrs, int defStyle) {
\r
18 super(context, attrs, defStyle);
\r
22 protected void onDraw( Canvas canvas ) {
\r
24 int bottom = this.getBottom();
\r
25 int top = this.getTop();
\r
26 int right = this.getRight();
\r
27 int left = this.getLeft();
\r
29 // int rotX = left + (right - left)/2;
\r
30 // int rotY = top + (bottom-top)/2;
\r
32 /*int rotX = (right - left)/2;
\r
33 int rotY = (bottom-top)/2; */
\r
34 int rotX = this.getWidth()/2;
\r
35 int rotY = this.getHeight()/2;
\r
37 canvas.rotate(180, rotX, rotY);
\r
38 super.onDraw(canvas);
\r