android.support.v7.app.ActionBarActivity.onCreateOptionsMenu()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(35)

本文整理了Java中android.support.v7.app.ActionBarActivity.onCreateOptionsMenu()方法的一些代码示例,展示了ActionBarActivity.onCreateOptionsMenu()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ActionBarActivity.onCreateOptionsMenu()方法的具体详情如下:
包路径:android.support.v7.app.ActionBarActivity
类名称:ActionBarActivity
方法名:onCreateOptionsMenu

ActionBarActivity.onCreateOptionsMenu介绍

暂无

代码示例

代码示例来源:origin: ogaclejapan/ArcLayout

@Override
public boolean onCreateOptionsMenu(Menu menu) {
 getMenuInflater().inflate(R.menu.menu_main, menu);
 return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: ogaclejapan/ArcLayout

@Override
public boolean onCreateOptionsMenu(Menu menu) {
 getMenuInflater().inflate(R.menu.menu_demo, menu);
 return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: geeksonsecurity/android-overlay-protection

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  /* if (!mNavigationDrawerFragment.isDrawerOpen()) {
    // Only show items in the action bar relevant to this screen
    // if the drawer is not showing. Otherwise, let the drawer
    // decide what to show in the action bar.
    getMenuInflater().inflate(R.menu.main, menu);
    restoreActionBar();
    return true;
  }*/
  return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: RomascuAndrei/BTNotifierAndroid

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: SimonMarquis/Android-PreferencesManager

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  getMenuInflater().inflate(R.menu.file_activity, menu);
  return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: sismics/reader

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.categories_activity, menu);
  return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: SimonMarquis/Android-PreferencesManager

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  getMenuInflater().inflate(R.menu.preferences_activity, menu);
  return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: marcoRS/rxjava-essentials

@Override public boolean onCreateOptionsMenu(Menu menu) {
 getMenuInflater().inflate(com.packtpub.apps.rxjava_essentials.R.menu.main, menu);
 return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: sismics/reader

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.article_activity, menu);
  
  // Store favorite button to change his icon
  starMenuItem = menu.findItem(R.id.star);
  
  updateActionBar();
  return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: googlesamples/android-ActionBarCompat-ShareActionProvider

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu resource
  getMenuInflater().inflate(R.menu.main_menu, menu);
  // Retrieve the share menu item
  MenuItem shareItem = menu.findItem(R.id.menu_share);
  // Now get the ShareActionProvider from the item
  mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem);
  // Get the ViewPager's current item position and set its ShareIntent.
  int currentViewPagerItem = ((ViewPager) findViewById(R.id.viewpager)).getCurrentItem();
  setShareIntent(currentViewPagerItem);
  return super.onCreateOptionsMenu(menu);
}
// END_INCLUDE(get_sap)

代码示例来源:origin: sismics/reader

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  MenuInflater inflater = getMenuInflater();
  inflater.inflate(R.menu.main, menu);
  // Get the SearchView and set the searchable configuration
  SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
  searchItem = menu.findItem(R.id.action_search);
  SearchView searchView = (SearchView) searchItem.getActionView();
  searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
  return super.onCreateOptionsMenu(menu);
}

代码示例来源:origin: SimonMarquis/Android-PreferencesManager

@Override
public boolean onCreateOptionsMenu(Menu menu) {
  getMenuInflater().inflate(R.menu.app_list_activity, menu);
  MenuItem searchItem = menu.findItem(R.id.menu_search);
  mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
  mSearchView.setQueryHint(getString(R.string.action_search));
  mSearchView.setOnQueryTextListener(new OnQueryTextListener() {
    @Override
    public boolean onQueryTextSubmit(String s) {
      Ui.hideSoftKeyboard(getApplicationContext(), mSearchView);
      mSearchView.clearFocus();
      return true;
    }
    @Override
    public boolean onQueryTextChange(String s) {
      return updateFilter(s);
    }
  });
  MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() {
    @Override
    public boolean onMenuItemActionExpand(MenuItem menuItem) {
      return true;
    }
    @Override
    public boolean onMenuItemActionCollapse(MenuItem menuItem) {
      return updateFilter(null);
    }
  });
  return super.onCreateOptionsMenu(menu);
}

相关文章