I'm willing to add a Spinner that will open when I click on the Activity's title in the ActionBar
(I don't use a Toolbar
, I use the support ActionBar
).
I tried with the method setListNavigationCallbacks(SpinnerAdapter adapter, ActionBar.OnNavigationListener callback)
on the ActionBar. It works, but it displays the selected item next to the title.
Code of the Activity onCreate
actionBar.setTitle("Title");
actionBar.setNavigationMode(NAVIGATION_MODE_LIST);
actionBar.setListNavigationCallbacks(spinnerAdapter, null);
// spinnerAdapter contains simply numbers from 1 to 10
I know that using these methods and using the support ActionBar instead of the Toolbar are deprecated, but changing the ActionBar by the Toolbar in my project will have huge impacts and I will have a lot of work to do...
I don't want to use any external library if possible, as this is obviously not very complicated to do.
Thank you!