Android Some devices have up to two bar, we can get information about these bars. Put the code that gets the height below. Code comments and other methods are free to put.
Original address http://www.cnblogs.com/rossoneri/p/4142962.html
Get Top status bar height
Private int getstatusbarheight () { = mactivity.getresources (); int resourceId = resources.getidentifier ("Status_bar_height", "Dimen", "Android"); int height = resources.getdimensionpixelsize (resourceId); LOG.V ("dBW", "Status Height:" + height); return height;}
Get bottom navigation bar height
Private int getnavigationbarheight () { = mactivity.getresources (); int resourceId = resources.getidentifier ("Navigation_bar_height", "Dimen", "Android"); int height = resources.getdimensionpixelsize (resourceId); LOG.V ("dBW", "Navi Height:" + height); return height;}
Android Gets the height of the system top status bar (StatusBar) and the bottom toolbar (navigationbar)