Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong height for toolbar in landscape #38

Open
matpag opened this issue Mar 15, 2015 · 5 comments
Open

wrong height for toolbar in landscape #38

matpag opened this issue Mar 15, 2015 · 5 comments

Comments

@matpag
Copy link

matpag commented Mar 15, 2015

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
Copy link
Owner

kanytu commented Mar 17, 2015

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
Copy link
Author

matpag commented Mar 17, 2015

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
Copy link
Owner

kanytu commented Mar 18, 2015

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

@femosso
Copy link

femosso commented Apr 29, 2015

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
Copy link

Works for me, thanks :)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants