Image Scaling on a HD/QHD device different dependending on whether a background is defined or not

StephanSteinerStephanSteiner CHMember
edited December 2016 in Xamarin.Android


I've had this issue that certain of my image buttons's images would look way too small on large screen devices. When I tried to get to the bottom of it, I found that scaling of my icons (taken from the standard android icon set) would differ depending on whether or not I use a background for the image buttons.

Here's a simple layout I'm using

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="" android:layout_width="fill_parent" android:layout_height="fill_parent"> <fragment class="SmartAppMobileAndroid.CallHistoryFragment" android:id="@+id/callHistory" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@+id/callHistory_clearButton" /> <ImageButton android:id="@+id/callHistory_clearButton" android:layout_height="40dp" android:layout_width="wrap_content" style="?android:attr/borderlessButtonStyle" android:src="@drawable/dark_5_content_discard" android:scaleType="centerInside" android:background="@android:color/transparent" android:layout_alignParentBottom="true" /> </RelativeLayout>

The way it is written above, it looks fine on 720p devices, 1080p devices and QHD devices. If I remove the line


from the button, the image looks squished on FHD and QHD devices. Given that the rest is the same.. could this be a bug? Why should background have anything to do with scaling?

Sign In or Register to comment.