Hello!
A have a custom GridLayout class:
`using System;
using Android.Widget;
using Android.Content;
using Android.Graphics;
namespace SUDOKU
{
public class GridLayoutExt:GridLayout
{
public GridLayoutExt (Context context):base(context)
{
SetWillNotDraw (false);
}
protected override void OnDraw(Canvas canvas) { base.OnDraw (canvas); Paint paint = new Paint (); paint.Color = Android.Graphics.Color.Red; paint.StrokeWidth = 4; canvas.DrawLine (0, 0, 100, 100, paint); } }
}`
How can I add it to the screen of my application&
When I'm trying to start application I have an exception:java.lang.reflect.InvocationTargetException
In this place:GridLayoutExt GL = new GridLayoutExt (this); GL.ColumnCount = ColNum; **GL.LayoutParameters.Width = getWidth();** GL.LayoutParameters.Height = getWidth();
Here is the getWidth() method:
`public int getWidth()
{
int widthInP;
var metrics = Resources.DisplayMetrics;
widthInP = metrics.WidthPixels;//ConvertPixelsToDp(metrics.WidthPixels);
return widthInP; }`
How can I resolve this problem?
Thank you for help!
Answers
May be some body have another way to solve my problem?
How can I draw lines above my gridlayout?
Thank you!