title: Images automatically resized
body: <p>Programming android using Xamarin, i have a couple of images in <strong>32x32</strong> pixels dimensions that i need to display on <code>canvas</code>. I have been testing the code using Android SDK Emulator with an <code>xhdpi</code> screen and the images seem to automatically resize to double their dimensions. i.e. they become <strong>64 pixels wide by 64 pixels tall</strong>. I then created another AVD with <code>mdpi</code> screen and the images seem to be the correct size.</p>
  
  <p>I have read about density independent pixels on the <a href="http://developer.android.com/guide/practices/screens_support.html" rel="nofollow noreferrer">android documentation</a> and other websites, but can't seem to understand why the image dimensions would resize automatically. Is there an implicit resizing taking place behind the scenes? If so, why would the android developers not mention it in their documentation? Is there anything else I need to set up? Below is a relevant part of the code (my images being resized are <em>jp1</em>, <em>jp2</em>, etc):</p>
  
  <pre><code>    Paint bkgBmpPaint = new Paint(); Color myColor = new Color(); 
      Paint myTextPaint = new Paint();
      private int a = 0, b = 0, bw = 0; 
              private Bitmap partialBitmap = null;
              DisplayMetrics dm = new DisplayMetrics();
              private Bitmap jp1,jp2,jp3,jp4;
  
              public MyCanvasPath(Context context) : base(context) //constructor
              {
      partialBitmap = Bitmap.CreateBitmap(Resources.Configuration.ScreenWidthDp, Resources.Configuration.ScreenHeightDp,Bitmap.Config.Argb8888);
                  float scale = Resources.DisplayMetrics.Density;
      jp1 = BitmapFactory.DecodeResource(Resources, Resource.Drawable.jp1);
      jp2 = BitmapFactory.DecodeResource(Resources, Resource.Drawable.jp2);
      jp3 = BitmapFactory.DecodeResource(Resources, Resource.Drawable.jp3);
      jp4 = BitmapFactory.DecodeResource(Resources, Resource.Drawable.jp4);
  
                  Canvas myCanvas = new Canvas(partialBitmap); b = myCanvas.Height; a = myCanvas.Width; bw = jp1.Width;
                  IList&lt;Bitmap&gt; pImgList = new List&lt;Bitmap&gt; {
                   jp1, jp2, jp3, jp4  };
                  imgCount = pImgList.Count;
                      for (int x = 0; x &lt; imgCount; x++)
                      {
                          myCanvas.DrawBitmap(pBmpList.ElementAt(x), bw * x, 0, null);
                      }}
  protected override void OnDraw(Canvas screenCanvas)
          {
              screenCanvas.DrawBitmap(partialBitmap, 0, 0, null);
              partialBitmap.Recycle();
          }
  </code></pre>