android自己写的类似刻度尺的东西(7)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-06 08:44 点击:次
mSurfaceHolder.unlockCanvasAndPost(canvas);
}
}
class StaffView extends SurfaceView implements SurfaceHolder.Callback, Runnable{
private SurfaceHolder mSurfaceHolder = null;
private Canvas canvas;
private Paint paint;
//画布背景
private Bitmap background;
//刻度
private Bitmap staff;
//刻度游标
private Bitmap pointer;
//初始值
private float initValue;
//刻度单位最小值
private float interval;
//单位
private String unit;
//是否初始
private boolean isInit = true;
public StaffView(Context context, float initValue, float interval, String unit) {
super(context);
mSurfaceHolder = this.getHolder();
mSurfaceHolder.addCallback(this);
paint = new Paint();
this.setFocusable(true);
background = BitmapFactory.decodeResource(getResources(), R.drawable.staff_bg);
staff = BitmapFactory.decodeResource(getResources(), R.drawable.staff0);
pointer = BitmapFactory.decodeResource(getResources(), R.drawable.kedu_pointer);
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>