Imageview with frame and image <p>I am working on android app and I want to create imageview that background is frame and src is image, but always there is space between them Also I want to do that the image will cut in case that his edge bigger then the frame. thanks!</p> <pre><code> &lt;TableLayout android:id="@+id/layoutItems" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="*" &gt; &lt;TableRow android:id="@+id/row1" android:layout_width="match_parent" android:layout_height="fill_parent" android:orientation="horizontal"&gt; &lt;ImageView android:id="@+id/frame_1_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="2sp" android:layout_marginTop="2sp" android:layout_marginLeft="13sp" android:layout_marginRight="10sp" android:contentDescription="@string/line" android:background="@drawable/picture_gallery_frame"/&gt; &lt;ImageView android:id="@+id/frame_1_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="2sp" android:layout_marginTop="2sp" android:layout_marginLeft="10sp" android:layout_marginRight="13sp" android:contentDescription="@string/line" android:background="@drawable/picture_gallery_frame"/&gt; &lt;/TableRow&gt; </code></pre> <p>I have more rows like that one and I add src with that code progamatically:</p> <pre><code>File f = new File(media.get(media.size() - 1).getmMediaPath()); if (f.exists() &amp;&amp; f != null) { try { Uri u = Uri.parse(f.getPath()); if (ProfileActivity.tryJpegRead(iv, f)) { //Bitmap bitmap = BitmapUtils.getSafeDecodeBitmap(getPath(u), 512); //iv.setImageBitmap(BitmapUtils.makeRegularScaledBitmap(bitmap, 1.0f, 1.3f)); iv.setImageURI(u); } } catch (Exception e) { iv.setImageResource(R.drawable.sample); } } else { iv.setImageResource(R.drawable.sample); } </code></pre>