Search code examples
androidiconsnavigation-drawerandroid-5.0-lollipopandroid-appcompat

Navigation drawer icon is not centered vertically (landscape mode, Android)


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...


Solution

  • 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.