I'm drawing text on a custom map marker in a custom renderer (Android). The text shows up fine on a phone but in a tablet the text is way too large.
What is the best way to make the text adapt to both a phone and a tablet? In native android, one would use scalable pixels. How should this be approached in Xamarin Forms? Below is the relevant code:
public static BitmapDrawable WriteOnDrawable(Context context, int drawableId, String text, Color color)
{
Bitmap bitmap = BitmapFactory.DecodeResource(context.Resources, drawableId)
.Copy(Bitmap.Config.Argb8888, true);
Paint paint = new Paint();
paint.SetStyle(Paint.Style.Fill);
paint.Color = color;
paint.TextSize = 50;
paint.TextAlign = Paint.Align.Center;
paint.AntiAlias = true;
Canvas canvas = new Canvas(bitmap);
canvas.DrawText(text, bitmap.Width / 2 //x position
, bitmap.Height / 2 // y position
, paint);
return new BitmapDrawable(context.Resources, bitmap);
}