max.mustermann1
max.mustermann1

Reputation: 61

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

Upvotes: 0

Views: 767

Answers (2)

max.mustermann1
max.mustermann1

Reputation: 61

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

Upvotes: 1

Nikola Despotoski
Nikola Despotoski

Reputation: 50538

Try to override abc_dropdownitem_text_padding_left to 0dp or negative value using ref.xml. Default value is 8dp, when you add 72dp content inset this will move all content to right including their padding which contribute to those you see as 100dp.

Upvotes: 0

Related Questions