I'd like to have a non-standard height toolbar which has centered buttons and navigation, but I can't get it to work. I use this example layout:
<Toolbar
android:id="@+id/toolbar_regular"
android:background="#777"
android:layout_width="300dp"
android:layout_height="100dp" />
And it ends up looking like this:
Make a menu xml This is going to be in res/menu/main_menu . Right click the res folder and choose New > Android Resource File. Type main_menu for the File name. Choose Menu for the Resource type.
suggest use android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" instead. To keep using default styles for the customised TextView, try something like style="@style/TextAppearance. AppCompat. Widget.
The Toolbar (if not extended) has the height of: 56dp (default)
Per a conversation on G+ with Chris Banes, you can use minHeight to define the constrained height for actions and buttons. This value defaults to ?attr/actionBarSize on Toolbar. So, I used the layout
<Toolbar
android:id="@+id/toolbar_regular"
android:background="#777"
android:minHeight="100dp"
android:layout_width="300dp"
android:layout_height="100dp" />
to get this appearance:
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