119
I found a way to do it without creating your own images. In other words, the system image is being scaled. I don't pretend that the solution is perfect; if anyone knows a way to shorten some of the steps, I'll be happy to find out how.
First, I put the following in the main activity class of the project (WonActivity) . This was taken directly from Stack Overflow -- thank you guys!
/** get the default drawable for the check box */
Drawable getDefaultCheckBoxDrawable()
{
int resID = 0;
if (Build.VERSION.SDK_INT <= 10)
{
// pre-Honeycomb has a different way of setting the CheckBox button drawable
resID = Resources.getSystem().getIdentifier("btn_check", "drawable", "android");
}
else
{
// starting with Honeycomb, retrieve the theme-based indicator as CheckBox button drawable
TypedValue value = new TypedValue();
getApplicationContext().getTheme().resolveAttribute(android.R.attr.listChoiceIndicatorMultiple, value, true);
resID = value.resourceId;
}
return getResources().getDrawable(resID);
}
Second, I created a class to "scale a drawable". Please notice that it is completely different from the standard ScaleDrawable.
import android.graphics.drawable.*;
/** The drawable that scales the contained drawable */
public class ScalingDrawable extends LayerDrawable
{
/** X scale */
float scaleX;
/** Y scale */
float scaleY;
ScalingDrawable(Drawable d, float scaleX, float scaleY)
{
super(new Drawable[] { d });
setScale(scaleX, scaleY);
}
ScalingDrawable(Drawable d, float scale)
{
this(d, scale, scale);
}
/** set the scales */
void setScale(float scaleX, float scaleY)
{
this.scaleX = scaleX;
this.scaleY = scaleY;
}
/** set the scale -- proportional scaling */
void setScale(float scale)
{
setScale(scale, scale);
}
// The following is what I wrote this for!
@Override
public int getIntri