Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dpi to pixel converter for Xamarin Android
using Android.Content;
namespace Droid
{
public static class DpiToPixelConverter
{
public static int Convert(int dpi)
{
float scale = Application.Context.Resources.DisplayMetrics.Density;
return (int)(dpi * scale + 0.5f);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.