Is there a way to detect programmatically whether the notification area is located at the top of the screen or in the bottom right corner (like on most tablets) ?
-
1This is a good question, but why? What evil intentions do you have in mind with this knowledge? :-p – ahodder Dec 21 '12 at 16:02
-
4Note: to complicate things a bit Nexus 7 is a tablet and has its notifications along the top, rather than at the bottom right. – FoamyGuy Dec 21 '12 at 16:02
-
@FoamyGuy you're right, I meant "on most tablets". I guess. :) – sdabet Dec 21 '12 at 16:09
-
1(*not sure if this will help but worth a shot*) Try some of the techniques in this question: http://stackoverflow.com/questions/3407256/height-of-status-bar-in-android you might be able to glean where the notifications go based on the fact that the bottom bar is taller than the top bar. – FoamyGuy Dec 21 '12 at 16:15
1 Answers
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.

- 2,471
- 17
- 11