我已经像这样设置了我的操作栏,但是当我单击主页按钮时没有任何反应。下面的两个选项是启用的,所以它不应该自动进入家庭活动吗?
ab.setHomeButtonEnabled(true);
ab.setDisplayHomeAsUpEnabled(true);
操作栏
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
final String[] activities;
Resources res = getResources();
activities = res.getStringArray(R.array.activities);
ActionBar ab = getActionBar();
ab.setHomeButtonEnabled(true);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(R.string.app_name);
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
ab.show();
/** Create an array adapter to populate dropdownlist */
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getBaseContext(), android.R.layout.simple_spinner_dropdown_item, activities);
/** Setting dropdown items and item navigation listener for the actionbar */
getActionBar().setListNavigationCallbacks(adapter, navigationListener);
/** Enabling dropdown list navigation for the action bar */
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
return true;
}