Reputation: 5375
I want my action bar to show items. All three of the items are hidden in the triple dot icon even though I have android:showAsAction="ifRoom"
for all three items. There is certainly enough room, yet they aren't showing. How can I make them show?
MainActivity.cs:
protected override void OnCreate(Bundle savedInstanceState)
{
//...
this.ActionBar.SetDisplayHomeAsUpEnabled(true);
this.ActionBar.SetHomeButtonEnabled(true);
//...
}
//...
public override bool OnCreateOptionsMenu(IMenu menu)
{
return true;
}
MyFragment.cs (inherits Fragment)
public override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
HasOptionsMenu = true;
}
//...
public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
{
inflater.Inflate(Resource.Menu.actionbar_search, menu);
}
actionbar_search.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/addnew"
android:icon="@drawable/add_new"
android:title="Add New"
android:showAsAction="ifRoom"/>
<item android:id="@+id/searcher"
android:icon="@drawable/abc_ic_search"
android:title="Search"
android:showAsAction="ifRoom"/>
<item android:id="@+id/refresher"
android:icon="@drawable/refresh"
android:title="Refresh"
android:showAsAction="ifRoom"/>
</menu>
Also, the main activity is a Navigation Drawer that uses Fragments
for the content. It works similarly to this: http://developer.xamarin.com/samples/NavigationDrawer/
Upvotes: 1
Views: 3586