在Android中绘制可缩放的形状

时间:2014-08-26 06:16:07

标签: java android drawing android-canvas

我需要绘制一个十字形状,如下面的图像,我有一组固定的点,

                Path path = new Path();
                path.moveTo(133.133f, 45.7109f);
                path.lineTo(154.307f, 24.5363f);
                path.lineTo(175.482f, 45.7109f);
                path.lineTo(154.307f, 66.8856f);
                path.lineTo(175.482f, 88.0603f);
                path.lineTo(154.307f, 109.235f);
                path.lineTo(133.133f, 88.0603f);
                path.lineTo(111.958f, 109.235f);
                path.lineTo(90.7835f, 88.0603f);
                path.lineTo(111.958f, 66.8856f);
                path.lineTo(90.7835f, 45.7109f);
                path.lineTo(111.958f, 24.5363f);
                path.lineTo(133.133f, 45.7109f);
                canvas.drawPath(path, paint);

输出

Output of the above code

正常工作,

我的要求是将这个形状缩放到不同的大小,我试图缩放整个视图,但是在同一个画布中绘制的其他元素也受到了影响。你能否告诉我正确的存档方式?

0 个答案:

没有答案