构建一个动画应用程序,动画在android中完成从0到360的圆圈

时间:2015-09-13 22:43:43

标签: android animation android-animation android-canvas android-bitmap

我想构建一个应用程序,在android中动画一个从0到360的圆圈。我是android的新手,正在研究动画

Paint paint = new Paint();
        paint.setColor(Color.BLACK);
        paint.setStrokeWidth(5);
        paint.setStyle(Paint.Style.STROKE);

        Path path = new Path();
        float center_x, center_y;

        center_x = width/2;
        center_y = height/2;
        final RectF oval = new RectF();
        oval.set(center_x - radius,center_y - radius,center_x + radius,center_y + radius);
        path.addArc(oval, 0, 360);// like this line produce a complete circle but i want animation which start from 0 and end at 360

        canvas.drawPath(path, paint);

我尝试使用while循环使用invalidate();但它不起作用。所以请帮助我。

0 个答案:

没有答案