Android Xamarin在gridlayout上绘制线

Android Xamarin在gridlayout上绘制线,android,xamarin,Android,Xamarin,我在Xamarin中有一个android应用程序和一个带有数字的gridlayout表单。 我想在这些数字之间画不同宽度的线。 我该怎么做 谢谢大家! 如果要绘制不同宽度的线条,必须编写自定义网格布局并使用OnDraw override方法绘制线条 public class GridLayoutExt : GridLayout { public GridLayoutExt(Context context) : base(context) { //T

我在Xamarin中有一个android应用程序和一个带有数字的gridlayout表单。 我想在这些数字之间画不同宽度的线。 我该怎么做


谢谢大家!

如果要绘制不同宽度的线条,必须编写自定义网格布局并使用OnDraw override方法绘制线条

public class GridLayoutExt : GridLayout
{
    public GridLayoutExt(Context context)
        : base(context)
    {
        //This will enable the drawing of this Layout
        SetWillNotDraw(false);
    }


    protected override void OnDraw(Canvas canvas)
    {
        base.OnDraw(canvas);

        //Draw your lins based on your requirement
        //canvas.DrawLine();
    }
}

请发布一些您已经拥有的代码,也许还有一张您想要实现的绘图。如何将此自定义GridLayout添加到表单中?您是指Xamarin.Forms平台吗?