如何在代码中改变 ImageView的大小,  我用  imageview.setMaxHeight(150);    imageview.setMaxWidth(150);来设置好像不行, 下面是layout中的 ImageView 
          <ImageView android:id="@+id/imv_bg" android:layout_width="wrap_content"
android:layout_height="wrap_content"    
        android:adjustViewBounds="true"
        android:maxWidth="200dip"
        android:maxHeight="200dip"
        android:scaleType="fitCenter" android:background="@drawable/wifi"
android:layout_marginTop="65dip" android:layout_centerHorizontal="true">
</ImageView>

解决方案 »

  1.   

    代码当中有个LayoutParams类,该类就是设置view的大小的
    TextView textView = new TextView(this);
    LayoutParams mParams = new LayoutParams(100, 100);
    textView .setLayoutParams(mParams);
      

  2.   

    Android实现图片放大缩小http://blog.csdn.net/ameyume/archive/2010/12/21/6089334.aspx
      

  3.   

    为什么要用imageView呢?做动画?
    imageView改大小要些个LayoutParams了,可以用绝对布局的。最好还是向楼上说的用个bitmap  改matrix。
      

  4.   

    1) set adjustViewBounds to true 
    2) set maxWidth and maxHeight to 100 
    3) set the height and width layout params to WRAP_CONTENT.