Programming/Android

[Android] Dialog 위치 이동.

Fimtrus 2013. 3. 7. 15:31

완전 간단함..



//mShareDialog 는 다이얼로그 입니다^^;
WindowManager wm = (WindowManager) 
getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
WindowManager.LayoutParams params = mShareDialog.getWindow().getAttributes();
params.y = metrics.heightPixels - Util.getPxFromDp(44);
params.x = 1;
//이부분이 핵심!
mShareDialog.getWindow().setAttributes(params);