问题
I'm trying to follow the material guidelines and I aligned the Toolbar title with the avatar like the image below following the instructions of @ChrisBanes in this answer.
My issue now is that when the SearchView is activated, it's not aligned anymore as seen in the second image. (It was aligned before changing the inset)
Any ideas of how I can align both things instead of having to choose between one or the other?
回答1:
If you want to align avatar with search-view then you need remove space of homeup button and search-view.
FYI: search view behavior is different in large size device so you can go with custom action-bar.
回答2:
I solved it by using app:titleMarginStart="16dp" instead of changing the contentInset. I have tested it only in a xhdpi phone, though.
来源:https://stackoverflow.com/questions/38998161/align-toolbar-title-and-searchview-with-list-content-with-avatars