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) ?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With