I tried to set a custom title bar includes spinner object but everytime it gave me that exception called "You cannot combine custom titles with other title features". I searched to find a solution site by site and also i did everything correctly as described on the net but the exception never disappeared. There is a very silly question left on my mind that it can be related to android 3.0? I am developing with version 3.0 (honeycomb). I don't know what should i do.
Thank you adamp, i made it with your guidance. here is a simple action bar with spinner example. May help to someone who is facing the similar issue.
super.onCreate(savedInstanceState);
setContentView(R.layout.screens);
ActionBar bar = getActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
bar.setListNavigationCallbacks(new SpinnerAdapter(this, android.R.layout.simple_dropdown_item_1line, EczaneMgr.getInstance(this).getEczaneListAsSpinner()),
new OnNavigationListener() {
@Override
public boolean onNavigationItemSelected(int position, long itemId) {
Log.e("item position",String.valueOf(position));
return true;
//do whatever want to do...
}
}
);
The Action Bar used on Android 3.0+ is considered a title feature, and your Activity will get one by default if you are using one of the Holo themes. (Theme.Holo, Theme.Holo.Light, etc.) Theme.Holo is the default for apps with targetSdkVersion="11"
or above. The older "custom title bar" feature cannot be combined with the action bar, but you can use the action bar to do this instead.
Use the action bar's list navigation mode, set using ActionBar#setNavigationMode
and ActionBar#setListNavigationCallbacks
to specify an adapter that will supply spinner views.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With