Search code examples
androidmaterial-designsearchview

Align SearchView hint with Toolbar title when expanded


I'm trying to implement an Material Design like Toolbar including a search (using the support SearchView).

I run into the problem that I can't get the SearchView start at the same position (72dp from the left border) as the title. It's some dp more right than the title. How can I fix this?

I put contentInsetStart="72dp" to the toolbar for getting the title at the mentioned line, but the SearchView now starts like 100dp from the left.

I want to have it like this: enter image description here


Solution

  • The right solution for my problem was setting app:titleMarginStart="16dp" for the android.support.v7.widget.Toolbar.