private int getActionBarHeight ( ) { int actionBarHeight = 0 ; try { if ( mToolbar != null ) { actionBarHeight = mToolbar . getHeight ( ) ; } else if ( mHoldingActivity instanceof ActionBarActivity ) { ActionBar supportActionBar = ( ( ActionBarActivity ) mHoldingActivity ) . getSupportActionBar ( ) ; if ( supportActionBar != null ) { actionBarHeight = supportActionBar . getHeight ( ) ; } } else if ( mHoldingActivity instanceof AppCompatActivity ) { ActionBar supportActionBar = ( ( AppCompatActivity ) mHoldingActivity ) . getSupportActionBar ( ) ; if ( supportActionBar != null ) { actionBarHeight = supportActionBar . getHeight ( ) ; } } else if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) { android . app . ActionBar actionBar = mHoldingActivity . getActionBar ( ) ; if ( actionBar != null ) { actionBarHeight = actionBar . getHeight ( ) ; } } } catch ( NoClassDefFoundError e ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . HONEYCOMB ) { android . app . ActionBar actionBar = mHoldingActivity . getActionBar ( ) ; if ( actionBar != null ) { actionBarHeight = actionBar . getHeight ( ) ; } } } return actionBarHeight ; }
Retrieve action bar height .