我在我的应用程序中使用了Sherlock Action Bar。我在navigationMode中遇到了问题。
快照:
我的代码
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);
可能是我在设备android 2.3上使用ABS 4.4的问题?我能做什么?
答案 0 :(得分:0)
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);
试试这个