Home » Android » image-height auto? [on hold]

image-height auto? [on hold]

Posted by: admin November 1, 2017 Leave a comment

Questions:

Is it possible, to set android:layout_height="" at Image View in Android-Studio to “auto” or something.

I want to have the picture on every device with android:layout_width="match_parent" in the same height.

I apologize for my bad English.

Answers:

You can do it by setting scaleType property FIT_XY: see this link for more informations https://developer.android.com/reference/android/widget/ImageView.ScaleType.html

Questions:
Answers:

I was able to fix this probem myself.

android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:adjustViewBounds="true"

I added this to the ImageView in my layout file.