简体   繁体   中英

Android Image view stretch issue

I am working on a project. in that, I have used ImageView to show an image from web URL as well as local. in that image not show properly. I have tried to change its scale property for fitXY , center crop but not working properly.

It is possible to change image height and width as per my ImageView height and width without effect image quality . or any other way to fix that.

Try adjustViewBounds.

<ImageView
     android:layout_width="match_content"
     android:layout_height="wrap_content"
     android:src="@mipmap/ic_launcher"
      android:adjustViewBounds="true"
     />

If you want to use ImageView Scale Type here is some visual guidence. Click Here

If you facing problem with getting Image from web URL Use Picasso Library. To install picasso: Add this in your dependency in your Gradle file: compile 'com.squareup.picasso:picasso:2.5.2'

For loading Image from the web:

Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);

在imageview中设置属性android:adjustViewBounds="true"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM