在imageView中调整图像大小

时间:2013-12-27 10:36:35

标签: android imageview aspect-ratio

我想为一个图像定义maxHeight,它的adjustViewBounds已设置为true。 通过这种方式,adt自动保持宽高比。 有没有办法在不保持纵横比的情况下获得这种方法?

这是图像,我想从侧面拉伸它,而不是被移位:

this is the image, and i want to stretch it from sides, without being displaced

3 个答案:

答案 0 :(得分:1)

试试这个

<ImageView 
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:src="@drawable/your image name"
        android:scaleType="fitXY"/>

答案 1 :(得分:1)

你可以这样做

 <ImageView
    android:layout_width="100dp"
    android:layout_height="400dp"
    android:src="@drawable/ic_launcher" 
    android:scaleType="fitXY"/>

答案 2 :(得分:0)

我认为android:scaleType="fitXY"正是您所寻找的。

相关问题