Hi Bardi,There is no direct approach to add custom layout as android widgetReference link:Maybe we can try to add custom layout as image by below link.Regards,Bharathi.
var data = new Hour_Range(Application.Context);
Bitmap bitmap = getBitmapFromView(data.chart);
widgetView.SetImageViewBitmap(Resource.Id.chart, bitmap);
public Bitmap getBitmapFromView(View view)
{
Bitmap bitmap = Bitmap.CreateBitmap(view.Width, view.Height, Bitmap.Config.Argb8888);
Canvas canvas = new Canvas(bitmap);
view.Draw(canvas);
return bitmap;
}
{Java.Lang.IllegalArgumentException: width and height must be > 0
at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in <…}
data.chart.Measure(400, 400);
data.chart.Layout(0, 0, 400,400);
Bitmap bitmap = Bitmap.CreateBitmap(400,400, Bitmap.Config.Argb8888);
. . .
chart.DrawingCacheEnabled = true;
. . .
Android.Graphics.Bitmap bitmap = null;
using (bitmap = chart.DrawingCache)
{
. . .
try
{
//Update bitmap to widget
}
}
finally
{
chart.DrawingCacheEnabled = false;
}
. . .
}
|
Android.Graphics.Bitmap bitmap = null;
MainActivity._chart.DrawingCacheEnabled = true;
using (bitmap = MainActivity._chart.DrawingCache)
{
try
{
//bitmap = getBitmapFromView(_chart);
widgetView.SetImageViewBitmap(playground.Droid.Resource.Id.chart, bitmap);
}
. . .
} |
Hi there
Are there any updates on this?