Guest User

Untitled

a guest
Jan 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. ImageView ivPct;
  2. Bitmap bitmap;
  3. Paint p;
  4. Canvas canvas;
  5.  
  6. ivPct= (ImageView) findViewById(R.id.iv_pct);
  7.  
  8. bitmap = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
  9. canvas = new Canvas(bitmap);
  10. p = new Paint(Paint.ANTI_ALIAS_FLAG);
  11.  
  12. int[] clr = new int[] {Color.RED, Color.YELLOW, Color.GREEN, Color.BLUE, Color.MAGENTA};
  13. for (int i = 0; i < clr.length; i++) {
  14. p.setColor(clr[i]);
  15. canvas.drawCircle(100, 100, 50, p);
  16. ivL.setImageBitmap(bitmap);
  17. .......
  18. }
  19.  
  20. Runnable runnable = new Runnable() {
  21. public void run() {
  22.  
  23. try {
  24. Thread.sleep(1000);
  25. } catch (InterruptedException e) {
  26.  
  27. }
  28.  
  29. h.sendEmptyMessage(qq);
  30.  
  31. }
  32. };
  33. Thread thread = new Thread(runnable);
  34. thread.start();
  35.  
  36. final Handler h = new Handler(new Handler.Callback() {
  37. @Override
  38. public boolean handleMessage(Message msg) {
  39. switch (msg.what) {
  40. case 1:
  41. //Перерисовка Bitmap
  42. }
  43. return true;
  44. }
  45. });
Add Comment
Please, Sign In to add comment