Imageview Adjustviewbounds Not Working

ImageView adjustViewBounds not working

The issue is that adjustViewBounds will not increase the size of the ImageView beyond the natural dimensions of the drawable. It will only shrink the view to maintain aspect ratio; if you provide a 500x500 image instead of a 50x50 image, this should work.

If you're interested in the spot where this behavior is implemented, see ImageView.java's onMeasure implementation.

One workaround is to implement a custom ImageView that changes this behavior in onMeasure.

ImageView adjustViewBounds not working with Relative Layout

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="100dp"
android:adjustViewBounds="true"

I got it there

ImageView adjustViewBounds not working with fitXY

set android:layout_width="wrap_content" And Use LinearLayout

Finally

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/test"
android:adjustViewBounds="true"
android:scaleType="fitXY"/>

For details please read android-imageview-scaletype-samples

FIT_XY

Scale the image using FILL.Stretch the picture inside the available width and height, disgarding the aspect ratio.

android ImageView adjustViewBounds not working. Whitespace

The problem was with the touchImageView. It created a whitespace which could not be removed.



Related Topics



Leave a reply



Submit