首页 > 移动平台 > 详细

Android 画个圆 淡入淡出

时间:2014-07-15 00:27:49      阅读:446      评论:0      收藏:0      [点我收藏+]
 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 画个圆 淡入淡出

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!