public class TurnPlateView extends View implements Runnable{
// 界面需要的图片
private Bitmap turnPlatePic; // 转盘图片
private Bitmap pointerPic; // 指针图片
// 旋转矩阵
private Matrix panRotate = new Matrix();
// 平移矩阵
private Matrix pointerTranslate = new Matrix();
private int x = 0;
private boolean ifRoate = false;
public TurnPlateView(Context context, AttributeSet attrs) {
super(context, attrs);
Resources r = context.getResources();
// 生成图片
turnPlatePic = BitmapFactory.decodeStream(r.openRawResource(R.drawable.turnplate));
pointerPic = BitmapFactory.decodeStream(r.openRawResource(R.drawable.pointer));
// 用线程刷新界面
Thread thread = new Thread(this);
thread.start();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.translate(75, 100)