In my activity when i press three dots, overflow menu shows normally like this
But when i long press "Recent apps" button it shows on bottom of screen like this
XML for menu:
<?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/search_bar_button"
android:icon="@drawable/ic_search"
android:title="Search"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="ifRoom|collapseActionView" />
<item
android:id="@+id/action_settings"
android:orderInCategory="1"
app:showAsAction="never"
android:title="@string/action_settings" />
</menu>
Code for menu:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.toolbar_menu, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchButton = menu.findItem(R.id.search_bar_button);
searchView = (android.support.v7.widget.SearchView) searchButton.getActionView();
searchView.setSearchableInfo(searchManager.getSearchableInfo(new ComponentName(getApplicationContext(), SearchActivity.class)));
return true;
}
I am using support Toolbar, and it happens on all versions of android. Also my theme is using NoActionBar is it because of that ?