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

[¾Èµå·ÎÀ̵å] È­¸é »çÀÌÁî ±¸Çϱâ
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 ¿µ¿ª¾È¿¡¼­ ¼³Á¤µÇ´Â µí...
ÃßõÃßõ : 261 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
1,226
android | ²¨Áø È­¸é¿¡¼­ ¾Û ½ÇÇàÇϱâ / Àáµç È­¸é ±ú¿ì±â / Àá±Ý È­¸é À§·Î ½ÇÇà/
1,225
android ÇöÀç WebView¿¡¼­ ¿ÜºÎ ÆäÀÌÁö ºÒ·¯¿À±â / WebView »õâ ¶ç¿ìÁö ¾Ê±â / WebViewClient
1,224
Activity ¸¦ dialog style·Î ¸¸µé±â
1,223
webview ¾Æ·¡ button ³Ö±â
1,222
webview scroll ±â´É ¸·±â(touch´Â µÊ)
1,221
Service µî·ÏÇϱâ
1,220
booting ÈÄ¿¡ ÀÚµ¿À¸·Î ½ÇÇà µÇ´Â app ¸¸µé±â
1,219
[Android] Intent È°¿ë ¿¹½Ã
1,218
Android ¼³Ä¡µÈ ¾îÇà ¸ñ·Ï PackageInfo¸¦ ÅëÇØ °¡Á®¿À±â ¹× ´Ù¸¥ ¾îÇà ½ÇÇà
1,217
[ANDROID(¾Èµå·ÎÀ̵å) ¾Û °³¹ß ±âÃÊ] MEDIAPLAYER À½¾Ç Àç»ýÇϱâ
1,216
[¾Èµå·ÎÀ̵å] ¿ÜºÎ ¾Û ½ÇÇà
1,215
¾Èµå·ÎÀÌµå ¼º´ÉÀ» À§ÇÑ ¼³°è
1,214
ÆÄÀÏ ¾÷·Îµå ¹× ÆĶó¸ÞÅÍ Àü¼Û (sending file & parameters by MultipartEntity / post)
1,213
MediaPlayer °¡·ÎÀÏ ¶§ UI ¼û±â°í Ç®½ºÅ©¸° ¸¸µé±â
1,212
À¥ºä¿¡¼­ html ÅÂ±× ¾ø¾Ö´Â ¹ý(Remove the html tag on loading web page in WebView)
1,211
´Ù¸¥ ¾Û ½ÇÇàÇϰųª Ç÷¹ÀÌ ½ºÅä¾î·Î À̵¿(Launch another app by code)
1,210
À¥ ºä¿¡¼­ ÅÂ±× Á¤º¸ ÃàÃâÇϱâ(Get the information of html tag in WebView of android)
1,209
ÀÚµ¿À¸·Î ¿¡µðÆ®ºä¿¡ Æ÷Ä¿½º µÇ´Â °Í ¸·±â
1,208
addJavascriptInterface ¿À·ù(Android WebView.addJavascriptInterface not Working)
1,207
Ä¿½ºÅÒ Å佺Ʈ ¶ç¿ì±â(To show Custom Toast)
1,206
À¥¿¡¼­ ÆÄÀÏ »çÀÌÁî¿Í ÄÜÅÙÆ®(ÄÁÅÙÃ÷) ŸÀÔ ¾Ë¾Æº¸´Â »ùÇÃÄÚµå
1,205
¾Èµå·ÎÀ̵å ÅؽºÆ® ºä¿¡¼­ Áö¿øÇÏ´Â HTML ű׵é
1,204
ÀÎÅÍ³Ý ÁÖ¼Ò À¯È¿¼º °Ë»ç (regular expression for url)
1,203
SpannableStringÀ¸·Î ÅؽºÆ® ºä¿¡ ¾ÆÀÌÄÜ ³Ö´Â ¹ý
1,202
½ÇÇà°¡´ÉÇÑ ¾Û ¸ñ·Ï (Get launchable apps in android)
1,201
HTMLÀ» ¾Èµå·ÎÀ̵å À¥ºä¿¡ ¸ðµÎ º¸ÀÌ°Ô Çϱâ Using WebView ViewPort in android
1,200
so ÆÄÀÏ ¾Èµå·ÎÀÌµå ½ºÆ©µð¿À¿¡¼­ »ç¿ëÇÏ´Â ¹ý
[¾Èµå·ÎÀ̵å] È­¸é »çÀÌÁî ±¸Çϱâ
1,198
[¾Èµå·ÎÀ̵å] ¾Èµå·ÎÀÌµå ½ºÆ©µð¿À¿¡¼­ ºôµå ÆÄÀÏ À̸§ ¼öÁ¤Çϱâ.
1,197
¿ÜºÎ ¾Û ½ÇÇà½ÃÅ°±â (launch external app in android)
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.