문제

I want to define maxHeight for an image that it's adjustViewBounds has been set to true. in this way adt automatically keeps aspect ratio. is there any way to gain this approach without keeping aspect ratio?

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

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

도움이 되었습니까?

해결책

You can do like this

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

다른 팁

try this

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

I think android:scaleType="fitXY" is what you are looking for.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top