title: How to make a border with ImageView?
body: <p>I have an application that selects photos and view it in a ImageView.
  I wanted the application to show the selected photos from the gallery in the same manner as Google+ does.</p>
  
  <p>I tried to use <code>CENTER_CROP</code> and <code>CENTER_INSIDE</code> but the photo runs over the border.</p>
  
  <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (resultCode == RESULT_OK) {
          if (requestCode == 1) {
              Uri si = data.getData();
              String[] fpc = {MediaStore.Images.Thumbnails.DATA};
  
              Cursor c = getContentResolver().query(si, fpc, null, null, null);
              c.moveToFirst();
  
              int ci = c.getColumnIndex(fpc[0]);
              String fp = c.getString(ci);
              c.close();
  
              ImageView iv = new ImageView(this);
              iv.setLayoutParams(new LinearLayout.LayoutParams(100, 100));
  
              iv.setImageBitmap(BitmapFactory.decodeFile(fp));
              iv.setScaleType(ImageView.ScaleType.CENTER_CROP);               
              iv.setBackgroundResource(R.drawable.btn_shp_selphoto);
  
              LinearLayout lay_gal = (LinearLayout) findViewById(R.id.summ_layout_gal);
              lay_gal.addView(iv);
          }
      }
  }
  </code></pre>