ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øã±â
ȨÀ¸·Î


[¾Èµå·ÎÀ̵å] È­¸é »çÀÌÁî ±¸Çϱâ
7³â Àü
¾Æ·¡ Äڵ忡¼­ 4°¡Áö ¹æ¹ýÀ¸·Î È­¸é »çÀÌÁ ±¸ÇÏ°í ÀÖ´Ù.
WindowManager wm = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE);
Window window = mActivity.getWindow();

Rect windowRect = new Rect();
Rect screenRect = new Rect();
//Excludes status bar & soft key
window.getDecorView().getWindowVisibleDisplayFrame(windowRect);
//Whole screen
window.getDecorView().getGlobalVisibleRect(screenRect);
int topGap = windowRect.top - screenRect.top;
// Sometimes, status bar is at bottom...
int bottomGap = windowRect.bottom - screenRect.bottom;
int statusBarHeight = (bottomGap > topGap)? bottomGap:topGap;

Log.i(TAG, "windowRect " + windowRect.toString());
Log.i(TAG, "screenRect " + screenRect.toString());

Point outSize = new Point();
//Content screen
wm.getDefaultDisplay().getSize(outSize);
Log.i(TAG, "outSize " + outSize.toString());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Point realSize = new Point();
        wm.getDefaultDisplay().getRealSize(realSize);//Whole screen
        Log.i(TAG, "realSize " + realSize.toString());
}



½ÇÁ¦ ·Î±×¸¦ Âï¾îº¸¸é, ´ëºÎºÐ °ªÀÌ ¸Â´Âµ¥ Æù¸¶´Ù outSize °ªÀÌ ´Ù¸£°Ô ³ª¿À´Â °æ¿ì°¡ ÀÖ´Ù. ¼ÒÇÁÆ® Å°¸¦ ¾²µç Çϵå¿þ¾î Å°¸¦ ¾²µç outSize¿¡¼­ ¾Ë¸²¹Ù ³ôÀÌ°¡ ºüÁ®¼­ ³ª¿À´Â °Ô »ó½ÄÀûÀ¸·Î ¸ÂÀ» °Í °°Áö¸¸ ±×·¸Áö ¾Ê´Ù. ¾Æ·¡´Â °¶³ëÆ®4¿Í ³Ø¼­½º5¸¦ ºñ±³ÇÑ °ÍÀÌ´Ù.

* soft key device (nexus 5 etc.)
windowRect Rect(0, 75 - 1080, 1776) -->status bar:75, soft key:144
screenRect Rect(0, 0 - 1080, 1920)
outSize Point(1080, 1776) --> Excludes status bar & soft key
realSize Point(1080, 1920)

* hard key device(G note4 etc.)
windowRect Rect(0, 100 - 1440, 2560) -->status bar:100
screenRect Rect(0, 0 - 1440, 2560)
outSize Point(1440, 2560) --> Contains status bar ;;
realSize Point(1440, 2560)

Á¶½ÉÇØ¾ß ÇÑ´Ù.


ÀÌ¿Í °ü·ÃÇؼ­ Á» ´çȲ½º·¯¿î °ÍÀÌ ÀÖ´Ù. PopupWindow¸¦ È­¸é ÇÏ´Ü¿¡ ¶ç¿ì·Á°í showAtLocation(View parent, Gravity gravity, int x, int y)À» ½ÇÇàÇß´Ù. À̶§ °ªÀÌ (gravity=top, x=0, y=0). »ó½ÄÀûÀ¸·Î outSize.bottom¿¡¼­ Ä¿½ºÅÒ ºäÀÇ ³ôÀ̸¸Å­ »©¸é Ä¿½ºÅÒ ºÎ°¡ ³õÀÏ À§Ä¡°¡ ³ª¿ÃÅÙµ¥, ³Ø¼­½º5¿¡¼­´Â ²À ¾Ë¸²¹Ù ³ôÀ̸¸Å­ Â÷ÀÌ°¡ ³­´Ù. ³­°¨ÇÏ´Ù.. ±×·¡¼­ È­¸éÀÇ ÇÏ´Ü¿¡ ºä¸¦ ³õ°íÀÚ ÇÑ´Ù¸é windowRect.bottom°ú screenRect.bottom ÀÌ ´Ù¸¥Áö ºñ±³Çغ¸ÀÚ.
mViewY = windowRect.bottom - mContainer.getMeasuredHeight();
if(windowRect.bottom != screenRect.bottom) {
    mViewY -= statusBarHeight;
}


Update : G2 ·Ñ¸®ÆË ¹öÀü(¼ÒÇÁƮŰ)¿¡¼­´Â ³Ø¼­½º5¿Í µ¿ÀÏÇÑ ¼öÄ¡°¡ ³ª¿ÀÁö¸¸, À§ Äڵ带 Àû¿ëÇÒ ¼ö ¾ø´Ù. ¼ÒÇÁÆ® Å°¸¦ °®°í ÀÖ´Â ÆùÀÌÁö¸¸ 0,0 °ªÀÇ ±âÁØÀÌ Æ˾÷ºäÀÇ parent ¿µ¿ª¾È¿¡¼­ ¼³Á¤µÇ´Â µí...
ÃßõÃßõ : 262 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
1,196
Service & Notification(¾Ë¸²¹Ù¶ç¿ì±â) ÀÌ¿ëÇϱâ
1,195
È­¸é ȸÀü(rotation) ó¸®
1,194
[Android] Àüüȭ¸é, title bar ¾ø¾Ö±â, status bar ¾ø¾Ö±â
1,193
ANDROID(¾Èµå·ÎÀ̵å) ¾Û °³¹ß ±âÃÊ] MEDIAPLAYER À½¾Ç Àç»ýÇϱâ
1,192
[Android]MediaPlayer¿¡¼­ »ç¿îµå¸¦ Àç»ýÇÏ´Â µÎ °¡Áö °æ·Î
1,191
¾Èµå·ÎÀ̵å Intent »ç¿ë¹ý
1,190
¾Èµå·ÎÀ̵å È­¸é Á¤¸®
1,189
ffmpeg ¿ÀÇ ¼Ò½º on ¾Èµå·ÎÀ̵å
1,188
WebView¿¡¼­ <a> ű×ÀÇ "_blank" target ó¸®Çϱâ.
1,187
Ư¼ö¹®ÀÚ, Ư¼ö¹®ÀÚÇ¥, Ư¼ö¹®ÀÚ ÇÏÆ®, ¿¹»Û Ư¼ö¹®ÀÚ
1,186
MediaPlayer 5¹ø¸¸ ¹Ýº¹Àç»ý
1,185
ÆÄÀÏ À§Ä¡¿¡ µû¸¥ ¹Ìµð¾î Àç»ý »ùÇÃÄÚµå
1,184
MJPEG on Android anyone?
1,183
Android °³¹ß
1,182
¾Èµå·ÎÀ̵å : ¾×ƼºñƼ ¶óÀÌÇÁ »çÀÌŬ (Activity Life Cycle)
1,181
¾Èµå·ÎÀ̵å ÇÁ·Î±×·¥ ÄÚµå·Î À¥ ºê¶ó¿ìÀú ½ÇÇàÇϱ⠿¹Á¦ (ÀÎÅÙÆ® »ç¿ë)
1,180
Áøµ¿ È¿°ú [Android]
1,179
Á¾·á ´ÙÀ̾ó·Î±× [Android]
1,178
´Ù¸¥¾Û È£Ãâ [Android]
1,177
TabActivity back key Event [Android]
1,176
³×Æ®¿öÅ© »óÅ [Android]
1,175
¾Èµå·ÎÀ̵忡¼­ À¥¼­¹ö¿¡ post·Î ±Û¾²±â [Android]
1,174
Webview ¼Ò½º [Android]
1,173
Coach mark View [Android]
1,172
¸ÖƼ ÇØ»óµµ [Android]
1,171
Webview source [Android]
1,170
°øÀ¯ Intent [Android]
1,169
intent uri ¸ðÀ½ [Android]
1,168
http post [Android]
1,167
http ¿äû [Android]
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.