C# 如何在Android中使用路径绘制三角形?
我需要画一个三角形,就像下面的图片一样,使用Android中的路径。你能在这方面提出有价值的建议吗 我已经尝试了以下代码片段。如果我在下面的代码片段中出错,请纠正我C# 如何在Android中使用路径绘制三角形?,c#,android,path,C#,Android,Path,我需要画一个三角形,就像下面的图片一样,使用Android中的路径。你能在这方面提出有价值的建议吗 我已经尝试了以下代码片段。如果我在下面的代码片段中出错,请纠正我 Android.Graphics.Point a = new Android.Graphics.Point(0, 0); Android.Graphics.Point b = new Android.Graphics.Point(0, 100); Android.Graphics.Po
Android.Graphics.Point a = new Android.Graphics.Point(0, 0);
Android.Graphics.Point b = new Android.Graphics.Point(0, 100);
Android.Graphics.Point c = new Android.Graphics.Point(87, 100);
_path = new Path();
_path.Reset();
_path.LineTo(b.X, b.Y);
_path.LineTo(c.X, c.Y);
_path.LineTo(a.X, a.Y);
_path.Close();
预期输出:
我认为只是坐标不对 试试这个
Path _path = new Path();
_path.reset();
_path.moveTo(0,100);
_path.lineTo(87, 100);
_path.lineTo(87, 0);
_path.close();
Paint paint = new Paint();
paint.setColor(Color.RED);
canvas.drawPath(_path, paint);
@Parthiban是否在自定义视图上绘制此路径?是的,通过覆盖Xamarin Boxview