I built my Toolbar like in most with minHeight set to actionBarSize:
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/colorPrimary"
android:minHeight="?actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
However, if I delete this attribute, there is no difference at all. The Toolbar keeps its actionBarSize, even if I remove the menu and set the app name to an empty String, so there is nothing displayed in the Toolbar at all.
Is there anything I'm missing here?
android:minHeight="?attr/actionBarSize"
minHeight will ensure that your toolbar does not resize itself lower than ?attr/actionBarSize not matter how small the content inside the toolbar is.
If there is nothing inside a toolbar and if minHeight is not set, the toolbar will have a default height of 56dp which is equal to ?attr/actionBarSize
So setting minHeight for toolbar is redundant
For more details, What's the height of the Android Toolbar?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With