Skip to content

Instantly share code, notes, and snippets.

@manadart
Created November 5, 2012 17:55
Show Gist options
  • Save manadart/4019179 to your computer and use it in GitHub Desktop.
Save manadart/4019179 to your computer and use it in GitHub Desktop.
MonoDroid Screen Size
// Method One.
var disp = WindowManager.DefaultDisplay;
var height = disp.Height;
var width = disp.Width;
Console.WriteLine("Default Display: {0}x{1}", width, height);
// Method Two.
var met = new DisplayMetrics();
disp.GetMetrics(met);
var heightm = met.HeightPixels;
var widthm = met.WidthPixels;
Console.WriteLine("Metrics: {0}x{1}", widthm, heightm);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment