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
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="100dp"
android:adjustViewBounds="true"
I got it there
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);
}