Android 画个圆 淡入淡出

 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 画个圆 淡入淡出,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。