I got this error setCropToPadding() NoSuchMethodError
when running my app on version < 4.1. How do I set cropToPadding to the image loaded to a GridView cell without ImageView XML?
Please help!
I got this error setCropToPadding() NoSuchMethodError
when running my app on version < 4.1. How do I set cropToPadding to the image loaded to a GridView cell without ImageView XML?
Please help!
Found this to be the best answer for my issue... for now. Copy and paste over and it simply worked!
try {
Field field = ImageView.class.getDeclaredField("mCropToPadding");
field.setAccessible(true);
field.set(imageView, true);
} catch (Exception e) {
e.printStackTrace();
}
Reference: https://gist.github.com/mrmans0n/2924241
setCropToPadding()
was introduced in API level 16 (JellyBean). Look at the top right: https://developer.android.com/reference/android/widget/ImageView.html#setCropToPadding(boolean)