我如何将字体画的bitmap中,然后再将bitmap画出来呢,为什么我这样做不行呢
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Bitmap bitmap = Bitmap.createBitmap(100, 200, Config.ARGB_8888);
Paint mPaint = new Paint();
mPaint.setColor(Color.RED);
mPaint.setTextSize(22.0f);
Canvas canvass = new Canvas(bitmap);
canvass.drawText(75+" km", 100, 60, mPaint);
Paint paint = new Paint();
canvas.drawBitmap(bitmap, 100,70, paint);
}
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Bitmap bitmap = Bitmap.createBitmap(100, 200, Config.ARGB_8888);
Paint mPaint = new Paint();
mPaint.setColor(Color.RED);
mPaint.setTextSize(22.0f);
Canvas canvass = new Canvas(bitmap);
canvass.drawText(75+" km", 100, 60, mPaint);
Paint paint = new Paint();
canvas.drawBitmap(bitmap, 100,70, paint);
}
解决方案 »
- android 4.0移动网络不可用 android4.0 “设置--更多--移动网络”这个选项没有 3G 信号栏指示没有
- 请问多网络可用的情况下,能控制用哪个吗?
- Android中类似与WinXP下自带的记事本
- websocket在Android手机上的应用~
- Xamarin 和mono的区别,两者是否一样的
- 手机端,使用什么方法实现视频硬解码
- android开发真机通过局域网连接本地服务器测试的问题?
- 求解cookiemanager的setcookie机制
- Myapplication里的成员变量置为NULL了怎么解决?
- ANDROID为什么data目录用Linux指令修改权限后还是打不开
- 急需listview多选用法的示例
- SurfaceView使用异常的问题
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//Bitmap bitmap = Bitmap.createBitmap(100, 200, Config.ARGB_8888);
Paint mPaint = new Paint();
mPaint.setColor(Color.RED);
mPaint.setTextSize(22.0f);
//Canvas canvass = new Canvas(bitmap);
canvas.drawText(75+" km", 100, 60, mPaint);
// Paint paint = new Paint();
// canvas.drawBitmap(bitmap, 100,70, paint);
}