Reputation: 73
I have a custom Actionbar and currently im trying to align the menu-icon to be on the left of the title. My actionbar
How can i achieve that?
Heres my "menu.xml":
<?xml version="1.0" encoding="utf-8" ?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_OpenMenu"
android:title="OpenMenu"
android:icon="@drawable/Image_OpenMenu"
app:showAsAction="always" />
<item
android:id="@+id/action_Search"
android:title="Search"
android:icon="@drawable/Image_Search"
android:queryHint="Search..."
app:showAsAction="always|collapseActionView"
app:actionViewClass="android.support.v7.widget.SearchView"/>
</menu>
And heres how i inflate it:
public override bool OnCreateOptionsMenu(IMenu menu)
{
MenuInflater.Inflate(Resource.Menu.Top_Menus_Main, menu);
// SearchView
var item = menu.FindItem(Resource.Id.action_Search);
var searchActionView = MenuItemCompat.GetActionView(item);
searchView = searchActionView as Android.Support.V7.Widget.SearchView;
return base.OnCreateOptionsMenu(menu);
}
Upvotes: 1
Views: 1110
Reputation: 1199
Action bar button are aligned at the right side you can not align them at the left side without custom view.
check out this How to set two custom actionbar button in left and right in android?
Upvotes: 1