object(mysqli_result)#13 (5) {
["current_field"]=>
int(0)
["field_count"]=>
int(25)
["lengths"]=>
NULL
["num_rows"]=>
int(1)
["type"]=>
int(0)
}
如何畫圓。How to draw a Circle. - 程序員論壇 - Powered by Discuz!
程序員論壇
標題: 如何畫圓。How to draw a Circle. [打印本頁]
作者: GreenCup 時間: 2021-4-1 14:38
標題: 如何畫圓。How to draw a Circle.
如何畫圓。
How to draw a Circle.- private Context context;
- public FrameLayout fLayout;
- private Canvas g;
複製代碼- Display display = _context.getDisplay();
- int width = display.getHeight();
- int height = display.getWidth();
- Bitmap bitmap = Bitmap.createBitmap(height, height, Bitmap.Config.RGB_565);
- g = new Canvas(bitmap);
- g.drawColor(Color.WHITE);
- g.drawBitmap(bitmap, 0F, 0F, null);
- Paint paint = new Paint();
- paint.setAntiAlias(true);
- paint.setDither(true);
- paint.setColor(Color.BLUE);
- paint.setStyle(Paint.Style.FILL);
- paint.setStrokeJoin(Paint.Join.ROUND);
- paint.setStrokeCap(Paint.Cap.ROUND);
- paint.setAlpha(0xff);
- paint.setStrokeWidth(1);
- g.drawCircle(height/2, height/2, height/2, paint); //Put your values
- // In order to display this image, we need to create a new ImageView that we can display.
- ImageView imageView = new ImageView(_context);
- // Set this ImageView's bitmap to ours
- imageView.setImageBitmap(bitmap);
- fLayout.addView(imageView);
複製代碼
歡迎光臨 程序員論壇 (http://program.thesmartfire.com/) |
Powered by Discuz! X2.5 |