android.support.design.widget.NavigationView.getContext()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(119)

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

暂无

代码示例

代码示例来源:origin: Catrobat/Paintroid

@Override
public void setVersion(String versionString) {
  String appName = navigationView.getContext().getString(R.string.pocketpaint_app_name);
  navigationMenuVersion.setTitle(appName + " v" + versionString);
}

代码示例来源:origin: konradrenner/kolabnotes-android

public MenuItem addNotebook(OnDrawerSelectionChangedListener listener, Notebook notebook){
  return addNotebook(view.getContext(), view.getMenu().findItem(R.id.navigation_notebooks).getSubMenu(), listener, notebook);
}

代码示例来源:origin: konradrenner/kolabnotes-android

public void overrideNotebooks(OnDrawerSelectionChangedListener listener, Collection<Notebook> notebooks){
  final Menu overview = view.getMenu();
  final SubMenu notebookSubmenu = overview.findItem(R.id.navigation_notebooks).getSubMenu();
  notebookSubmenu.clear();
  for(Notebook book : notebooks){
    addNotebook(view.getContext(), notebookSubmenu, listener, book);
  }
}

代码示例来源:origin: konradrenner/kolabnotes-android

public Set<AccountIdentifier> overrideAccounts(OnAccountSwitchedFromNavListener list, Account[] accounts, AccountManager accountManager, DrawerLayout layout){
  Set<AccountIdentifier> createdAccounts = new LinkedHashSet<>();
  final Menu menu = nav.getMenu();
  final Context context = nav.getContext();
  menu.removeGroup(R.id.drawer_accounts);
  createMenuItem(list, menu, context, 0, "local", context.getString(R.string.drawer_account_local), "Notes", "local", layout);
  for(int i=0;i<accounts.length;i++) {
    String email = accountManager.getUserData(accounts[i], AuthenticatorActivity.KEY_EMAIL);
    String name = accountManager.getUserData(accounts[i],AuthenticatorActivity.KEY_ACCOUNT_NAME);
    String rootFolder = accountManager.getUserData(accounts[i],AuthenticatorActivity.KEY_ROOT_FOLDER);
    String accountType = accountManager.getUserData(accounts[i], AuthenticatorActivity.KEY_ACCOUNT_TYPE);
    final AccountIdentifier accountIdentifier = createMenuItem(list, menu, context, i+1, email, name, rootFolder, accountType, layout);
    createdAccounts.remove(accountIdentifier);
  }
  return createdAccounts;
}

相关文章