Skip to content Skip to sidebar Skip to footer

Navigation Drawer Below Transparent Actionbar

I'm getting a transparent Actionbar by using the following code that @GunnarKarlsson shows here: Transparent Actionbar: custom tabcolor getWindow().requestFeature(Window.FEATURE_AC

Solution 1:

To achieve that you have to calculate Action Bar height and set marginTop to your navigation drawer. Use this method to calculate Action bar height:

publicstaticintCalculateActionBar(Context context){
        // Calculate ActionBar heightTypedValuetv=newTypedValue();
        if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {

           intmActionBarHeight= TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
           return mActionBarHeight;
        }
        return0;
    }

Then from java set Margin Top to your Navigation Drawer Object.

Doing this you will achieve a Navigation Drawer below Action Bar

Post a Comment for "Navigation Drawer Below Transparent Actionbar"