绘制圆圈内的圆以10的距离 [英] Draw a circle within circle at a distance of 10

查看:99
本文介绍了绘制圆圈内的圆以10的距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近已经开始与Android的工作,而我需要绘制圆圈内圆,就像下图在10的距离。如果你看到下面的照片,我需要绘制类似下面的圆圈两个直径一样,而我不需要那些目前没有照片上的任何图标。圆圈内有两个直径仅有一个圈子。

我只想绘制圆和两个直径,而不是圆形的图标。任何建议将AP preciated。

更新: -

我写了下面的code,但它提请只有一个圆。我需要绘制类似上面的图像 -

 公共无效的onCreate(包savedInstanceState){
            super.onCreate(savedInstanceState);

            的setContentView(demoview);
        }

        私有类DemoView扩展视图{
            公共DemoView(上下文的背景下){
                超(上下文);
            }

            @覆盖
            保护无效的OnDraw(帆布油画){
                super.onDraw(画布);
                涂料P =新的油漆();
                p.setColor(Color.RED);
                DashPathEffect dashPath =新DashPathEffect(新浮法[] {5,5},(浮动)1.0);

                p.setPathEffect(dashPath);
                p.setStyle(Style.STROKE);
                canvas.drawCircle(100,100,50,p)的;

                无效();
            }
        }
}
 

解决方案

尝试:

 保护无效的OnDraw(帆布油画){
            super.onDraw(画布);
            涂料P =新的油漆();
            p.setColor(Color.RED);
            DashPathEffect dashPath =新DashPathEffect(新浮法[] {5,5},(浮动)1.0);

            p.setPathEffect(dashPath);
            p.setStyle(Style.STROKE);


            的for(int i = 0;我7;;我++){
                canvas.drawCircle(100,100,50 +(I * 10),第);
            }


            无效();
        }
 

I have recently started working with Android, And I need to draw a Circle within Circle just like below image at a distance of 10. If you see the below photo, I need to draw something like below circle with two diameters like that and I don't need any icons that are there currently on the photo. Just a Circle within Circle having two diameters.

I want to draw only the circles and two diameter, not the icons on the circle. Any suggestions will be appreciated.

Update:-

I wrote the below code but it draws only one circle. I need to draw like the image above-

public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            setContentView(demoview);
        }

        private class DemoView extends View{
            public DemoView(Context context){
                super(context);
            }

            @Override
            protected void onDraw(Canvas canvas) {
                super.onDraw(canvas);
                Paint p = new Paint();
                p.setColor(Color.RED);
                DashPathEffect dashPath = new DashPathEffect(new float[]{5,5}, (float)1.0);

                p.setPathEffect(dashPath);
                p.setStyle(Style.STROKE);
                canvas.drawCircle(100, 100, 50, p);

                invalidate();
            }
        }
}

解决方案

Try:

protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            Paint p = new Paint();
            p.setColor(Color.RED);
            DashPathEffect dashPath = new DashPathEffect(new float[]{5,5}, (float)1.0);

            p.setPathEffect(dashPath);
            p.setStyle(Style.STROKE);


            for (int i = 0; i < 7; i ++) {
                canvas.drawCircle(100, 100, 50+(i*10), p);
            }


            invalidate();
        }

这篇关于绘制圆圈内的圆以10的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆