Code example for Resources

Methods: getDisplayMetrics

0
	private final Bitmap mShadow;
 
	public DropShadowDrawable(final Resources resources, final Bitmap bitmap, final float shadowRadius,
			final int shadowColor) {
		super(resources, bitmap);
		final float density = resources.getDisplayMetrics().density;
		mShadow = getDropShadow(bitmap, shadowRadius * density, shadowColor);
	} 
 
	public DropShadowDrawable(final Resources resources, final Drawable drawable, final float shadowRadius,
			final int shadowColor) {
		this(resources, Utils.getBitmap(drawable), shadowRadius, shadowColor);
	} 
 
	@Override 
	public void draw(final Canvas canvas) {
		canvas.drawBitmap(mShadow, 0, 0, null);
		super.draw(canvas);
	} 
 
	private static Bitmap getDropShadow(final Bitmap src, final float radius, final int color) {