[Source] PopupWindow »ç¿ë¿¹ |
|
|
 |
8³â Àü |
public class MyView extends View {
private PopupWindow mPopup;
// View(À»)¸¦ °¡Áø´ÙPopupWindow(À»)¸¦ ÀÛ¼ºÇÑ´Ù
public void makePopupWindow(View v) {
mPopup = new PopupWindow(context);
mPopup.setWindowLayoutMode(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
mPopup.setContentView(v);
}
// MyView(À¸)·ÎºÎÅÍÀÇ »ó´ë À§Ä¡(x, y)¿¡PopupWindow(À»)¸¦ Ç¥½ÃÇÑ´Ù
public void showPopupWindow(int x, int y) {
if (mPopup.isShowing()) {
View v = popup.getContentView()
int width = v.getMeasuredWidth();
int height = v.getMeasuredHeight();
mPopup.update(x, y, width, height);
} else {
mPopup.showAtLocation(this, Gravity.NO_GRAVITY, x, y);
}
}
}
|
|
̵̧ : 300 |
̵̧
¸ñ·Ï
|
|