I have a problem in regards to toolbar. I can't figure out how to align searchview (which is a menu item in my case) in the toolbar. When the searchview is expanded, it pushes the icon it has on its right to the edge of the screen, while also removing any margin it had on its left. Important thing to note here is that I'm using the searchview as a menu item:
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/search"
android:icon="@drawable/ic_search"
android:orderInCategory="1"
android:title="Search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="ifRoom" />
<item
android:id="@+id/filter"
android:icon="@drawable/ic_filter"
android:orderInCategory="2"
android:title="Filter"
android:visible="true"
app:showAsAction="always" />
Let me visualize on images:
Exhibit A:
This is how I would like to have it, with the expanded searchview occupying the middle "title" part while maintaining its margins
Exhibit B:
The reality
After looking and going through a ton of different threads and websites, I didn't find any solution that would help me. Do you have any ideas that I could try?