According to the docs, using the CENTER attribute will not perform any scaling on the image. Yet, when loading a PNG via XML like shown below, it appears significantly larger than it should be.
What’s going on?
I figure the image is being scaled when it’s loaded, but why? Is there some manifest tag missing, or should I be using a different folder?
<ImageView
android:src="@drawable/auth_logo"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:scaleType="center"></ImageView>
Any help would be appreciated.
Scaling of image is caused by difference between your image’s DPI and screen DPI.
Android manages scaling so that DPI matches.
Image’s DPI is determined by res source folder where image is stored (drawable / drawable-hdpi / etc), and actual screen density, which is given physically and is fixed for given device.
To avoid scaling, put your image into res/drawable-nodpi folder.