kanytu / android-material-drawer-template

An Android template with navigation drawer for material design
Apache License 2.0
674 stars 217 forks source link

wrong height for toolbar in landscape #38

Open matpag opened 9 years ago

matpag commented 9 years ago

If you try to rotate the device in landscape mode, you will notice that the app_title is not centered.

the solution is this:

in action_main.xml replaced with :

<include
    android:id="@+id/toolbar_actionbar"
    layout="@layout/toolbar_default"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize" />

and in toolbar_default.xml

<android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/ToolBarStyle"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary" />
kanytu commented 9 years ago

you will notice that the app_title is not centered.

Could you explain why it should be?

http://2.bp.blogspot.com/-7fF9ayZ6PgI/U9iFpk5FNEI/AAAAAAAAAs0/4P4SCvdB_4M/s1600/image00.png

matpag commented 9 years ago

test I have tried with your code, and like you can see in the image in devices 4.0+, the toolbar height change between landscape and portrait mode, it's not aligned with the app name text

Actionbar/toolbar height on 4.0+: default is 48dp, landscape is 40dp, sw600dp is 56dp

kanytu commented 9 years ago

That's not the expected behavior. The Toolbar should maintain it's size. I'm still investigating the problem.

femosso commented 9 years ago

Thanks man! This was very useful to me. Besides the alignment problem you mentioned, the nav drawer overlaps the toolbar in landscape mode. Your changes solve these two problems for me! Thank you :)

liutingdu commented 8 years ago

Works for me, thanks :)

But I couldn't understand the reason, any idea about why it's happening?