How to detect position of notifications area?

有没有办法通过程序检测通知区域位于屏幕的顶部还是右下角(就像大多数平板电脑一样)?


Notifications are always shown in a 25dp-tall status bar at the top of the display, except for sw600 devices (that is, the smallest width in any orientation is 600dp; see this blog post for more info) on API levels 11 (Honeycomb) through 16 (Jelly Bean pre-MR1). On those devices there is a 48dp-tall "combined system bar" at the bottom of the display.

The easiest way to check for this is via qualified resources; that is, put your top-status-bar-assuming layout in layout/foo.xml , but then have a bottom-system-bar version in layout-sw600dp/foo.xml . Finally, since these large devices now use the top status bar as of Android 4.2 (API 17) you'll need to switch back to the top-status-bar version in layout-sw600dp-v17/foo.xml .

If you just want a boolean value that will tell you whether the status bar is at the top, replace layout in the above example with values , and place a <bool> into foo.xml that is true except in the values-sw600dp case.

链接地址: http://www.djcxy.com/p/67766.html

上一篇: 点击获取数组元素与jQuery的索引

下一篇: 如何检测通知区域的位置?