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