Android – Standard height of toolbar

Its best to use ?attr/actionBarSize as @Jaison Brooks commented.

In the material guidelines, suggested height is 56dp:

Toolbar: 56dp

The recommended minimum size for touchable elements is 48 dp, see this page for more detailed metrics.

In addition to @vedant1811 answer, you can programmatically obtain actionBarSize from attrs:

TypedValue tv = new TypedValue();
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
{
    actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
}

Leave a Comment