I have an ImageView
and have set its layout_height
to \"100dp\" and its layout_width to \"wrap_content\".
The drawable used has bigger actual
use width and height of imageview to match_parent
private void addView(Drawable d) {
RelativeLayout.LayoutParams lparams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
ImageView iv = new ImageView(this);
iv.setImageDrawable(d);
iv.setAdjustViewBounds(true);
iv.setScaleType(ImageView.ScaleType.MATRIX);
iv.setLayoutParams(lparams);
rl.addView(iv);
iv.setOnTouchListener(this);
}