I have a switch I've defined in an XML file, and in it I'm setting
amdroid:drawableLeft="@drawable/my_image
However the image is way too big and overflows the screen. Is there someway to resize the drawable in XML or does it need to be done programmatically?
The best option is to resize the actual image and have an icon-sized version of it. This will improve performance and reduce memory usage by removing the need to resample the image.
Failing that, you can set the drawable programmatically:
Drawable icon = getResources().getDrawable(R.drawable.my_image);
icon.setBounds(0, 0, width, height);
myView.setCompoundDrawables(icon, 0, 0, 0);