I have a checkbox with a custom icon (bigger than the default icon) for the checkbox which I set like this:
mon = new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.checkbox_on));
moff = new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.checkbox_off));
state = new StateListDrawable();
state.addState(new int[] {-android.R.attr.state_checked}, moff);
state.addState(new int[] { android.R.attr.state_checked}, mon);
cb.setButtonDrawable(state);
It works well on a phone but on a tablet with a larger screen and resolution the icon is much larger but the text at the same time is much smaller than on the phone and the icon overlays the first few letters of the text. How can I prevent this?
Edit:
I verified that the problem is from the custom checkbox icon having a different size than the default checkbox icon. The sizes seem to be different for both devices, so is there a maybe way to find out which size the default checkbox icon has so I can make necessary adjustments to the size of custom icons or the padding ?