码迷,mamicode.com
首页 > 移动开发 > 详细

Android 画个圆 淡入淡出

时间:2014-07-15 00:28:07      阅读:457      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   java   color   

 private class SimpleView extends ImageView{  
        int point_x;  
        int point_y;  
        int radius = 0;  
        public SimpleView(Context context) {  
            super(context);  
            // TODO Auto-generated constructor stub  
        }  
        @Override  
        public boolean onTouchEvent(MotionEvent event) {  
            point_x = (int) event.getX();//获取点击位置  
            point_y = (int) event.getY();  
            if (event.getAction() == MotionEvent.ACTION_UP) {  
                upFlag = true;  
            }  
            invalidate();  
            return true;  
        };  
          
        protected void onDraw(android.graphics.Canvas canvas) {  
            alpha -= 3;  
            canvas.drawColor(Color.BLUE);   //设置背景色  
            Paint paint = new Paint();  
            paint.setColor(Color.WHITE);        //设置画笔颜色  
            paint.setAlpha(alpha);          //设置透明度  
            paint.setStyle(Paint.Style.FILL);  
            paint.setAntiAlias(true);  
            if (upFlag) {  
                ++radius;  
                if (radius > 26) {  
                    upFlag = false;  
                    radius = 0;  
                    alpha = 255;  
                }  
                if (radius == 18) {  
                    alpha = 100;  
                }  
                canvas.drawCircle(point_x, point_y, radius, paint); //画圆  
                invalidate();  
            }  
        }  
    } 

  转载至:http://blog.csdn.net/walker02/article/details/7254829

Android 画个圆 淡入淡出,布布扣,bubuko.com

Android 画个圆 淡入淡出

标签:android   style   blog   http   java   color   

原文地址:http://www.cnblogs.com/gfqFighting/p/3838001.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!