Im having problems with the new way to use toolbar. In landscape mode, toolbar title is centered vertically but the navigation drawer not. How can I solve this?
I am using the toolbar like in this post of Chris Banes: AppCompat v21 — Material Design for Pre-Lollipop Devices!
This is the code for the drawer icon in style.xml:
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@android:color/white</item>
</style>
And this is an image of the problem: Landscape image
EDIT: Overflow button is not centered vertically too...
This is my toolbar theme and everything is centered correctly:
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
style="@style/Widget.MyApp.Toolbar">
</android.support.v7.widget.Toolbar>
The example says to use android:minHeight="?actionBarSize"
and android:_layout_height="wrap_content"
but it only produced the error you described.
Add this in your toolbar style:
<item name="maxButtonHeight">?attr/actionBarSize</item>
This allows you to use wrap_content height and still have a centered icon!
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