Android ImageView centerCrop not working. Skewing instead of scaling

百般思念 提交于 2019-12-23 08:39:47

问题


I'm currently working on a Navigation Drawer where I want the user photo to be scaled, cropped, tinted, then used as the header image behind a circular crop of there picture.

I can't even post images because this account is too low rep...damn me and using my old student account for most of my questions...

Despite my ImageView being defined like this

<ImageView
    android:tint="@color/clyp_copy"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/pixplogo"
    android:scaleType="centerCrop"
    android:adjustViewBounds="true"/>

This image (1) skews like this (2) (Same link, two images)

This is actually a common issue for me. I've never gotten centerCrop to work properly. I don't understand why.

Testing on 5.1.1, building on SDK 23. Same issue on 21

Not sure if this is allowed on SO, but here's a Debug apk...maybe it's just my device...or 5.x


回答1:


Replace

android:background="@drawable/pixplogo"

with

android:src="@drawable/pixplogo"


来源:https://stackoverflow.com/questions/32813840/android-imageview-centercrop-not-working-skewing-instead-of-scaling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!