APPENDIX A: Retrieving the Height of the Status Bar and the Action Bar Dynamically

Chapter opener image: © Fon_nongkran/Shutterstock

If we define a View programmatically, we often need to retrieve the height of the content view, which is the total height of the screen minus the heights of the status bar and the action bar.

FIGURE A.1 shows the various parts of a device’s screen. The device’s status bar is shown in yellow: it typically includes some icons for system and application notifications, including the clock. In red is the app’s action bar, which typically includes the app name on the top left and a menu on the right, although it ...

Get Android App Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.