ImageView doesn't rescale Image to selected size

Posted by Buni on Stack Overflow See other posts from Stack Overflow or by Buni
Published on 2012-12-19T10:52:51Z Indexed on 2012/12/19 11:03 UTC
Read the original article Hit count: 295

I'm using a ImageView with a fixed size for adding an icon to a menu. In my application, I use it a lot of times, but on this ImageView the Layout Params seem to not work. Unlike the others ImageViews, in this case, I'm using a template directly, but I think that's not the problem.

<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="1dp"
    android:layout_height="1dp"
    android:scaleType="fitCenter"
    android:src="@drawable/ic_menu_moreoverflow_normal_holo_dark"
    android:contentDescription="ICON" />

Its been used in code as follows.

ImageView iview =(ImageView) View.inflate(context, R.layout.icon, null);

Theoretically, It should resize automatically the image, however, the images continues with the original size, although the size was 1dp. Where is the problem? Thanks a lot!

enter image description here

© Stack Overflow or respective owner

Related posts about android

Related posts about layout