I use Sherlock Action Bar in my application.And I have a problem in navigationMode.
Snapshot :
My code
actionBar = getSupportActionBar();
actionBar.setSubtitle("проверяем");
// выпадающий список
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
listList = listList();
if (listList != null) {
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.sherlock_spinner_item, listList);
adapter.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);//android.R.layout.simple_spinner_item);
// adapter
actionBar.setListNavigationCallbacks(adapter,
(OnNavigationListener) this);
}
setTitle("sdcdcsc");
getSupportActionBar().setDisplayShowHomeEnabled(false);
May be problem that I use ABS 4.4 on device android 2.3? What I can do?
String[] actions = new String[] { "Hotel", "Motel", "Pensiuni & Vile", "Camping"};
myArrayAdaptor<String> adptr = new myArrayAdaptor<String>(getBaseContext(),R.layout.sherlock_spinner_dropdown_item, actions);
/** Enabling dropdown list navigation for the action bar */
getSupportActionBar().setNavigationMode(com.actionbarsherlock.app.ActionBar.NAVIGATION_MODE_LIST);
getSupportActionBar().setTitle("Title");
getSupportActionBar().setDisplayShowHomeEnabled(false);
/** Defining Navigation listener */
ActionBar.OnNavigationListener navigationListener = new OnNavigationListener()
{
@Override
public boolean onNavigationItemSelected(int itemPosition,long itemId)
{
//other stuffs
return true;
}
};
getSupportActionBar().setListNavigationCallbacks(adptr, navigationListener);
adapter.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
Try like this
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.