1 package com.google.android.DemoKit; 2 3 import android.graphics.drawable.Drawable; 4 5 public class Utilities { centerAround(int x, int y, Drawable d)6 static void centerAround(int x, int y, Drawable d) { 7 int w = d.getIntrinsicWidth(); 8 int h = d.getIntrinsicHeight(); 9 int left = x - w / 2; 10 int top = y - h / 2; 11 int right = left + w; 12 int bottom = top + h; 13 d.setBounds(left, top, right, bottom); 14 } 15 16 } 17