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
Change Background of Edittext's Error Message
How to Change Color of Vector Drawable Path on Button Click
Android Volley Imageloader - Bitmaplrucache Parameter
How to Load Image as Bitmap to Glide
Android Build Gradle Is Too Slow (Dependency Resolution)
Android Studio: "Use Default Gradle Wrapper" VS. "Use Customizable Gradle Wrapper"
Android: How to Check How Much Memory Is Remaining
Android Studio 3.1 Edittext Stackoverflowerror
How to Avoid Restarting Activity When Orientation Changes on Android
Unfortunately App Is Getting Stopped While Checking for Network
How to Set Android Tablayout in The Bottom of The Screen
On Android, How to Switch Activities Programmatically
How to Hide The Soft-Key Bar on Android Phone
No Repository Found Error in Installing Adt in Eclipse Indigo
Change Navigation Bar Icon Color on Android
Creating Custom Overlay on The Map
How to Set Status Bar Background as Gradient Color or a Drawable in Android