當前位置: 首頁>>代碼示例>>Java>>正文


Java ContextMenu.setHeaderTitle方法代碼示例

本文整理匯總了Java中android.view.ContextMenu.setHeaderTitle方法的典型用法代碼示例。如果您正苦於以下問題:Java ContextMenu.setHeaderTitle方法的具體用法?Java ContextMenu.setHeaderTitle怎麽用?Java ContextMenu.setHeaderTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.ContextMenu的用法示例。


在下文中一共展示了ContextMenu.setHeaderTitle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
    ContextMenuInfo menuInfo) {
  if (v.getId() != R.id.accounts_list) {
    return;
  }

  AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
  Account account = (Account) adapter.getItem(info.position);
  menu.setHeaderTitle(account.toString());

  String[] menuItems = getResources().getStringArray(R.array.account_actions);
  for (int i = 0; i < menuItems.length; i++) {
    menu.add(Menu.NONE, i, i, menuItems[i]);
  }
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:17,代碼來源:AccountsActivity.java

示例2: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    if (!canCreateContextMenu(menu, menuInfo)) {
        return;
    }
    menu.clear();
    ViewHolder holder = (ViewHolder) ((AdapterContextMenuInfo) menuInfo).targetView.getTag();
    menu.setHeaderTitle(holder.nameView.getText());
    if (holder.icon != null) {
        setHeaderIcon(menu, holder.icon);
    }
    menu.add(Menu.NONE, R.string.app_info, Menu.NONE, R.string.app_info);
    updatePreventMenu(menu, holder.packageName);
    if (getMainIntent(holder.packageName) != null) {
        menu.add(Menu.NONE, R.string.open, Menu.NONE, R.string.open);
    }
    if (holder.canUninstall) {
        menu.add(Menu.NONE, R.string.uninstall, Menu.NONE, R.string.uninstall);
    }
    if (appNotification) {
        menu.add(Menu.NONE, R.string.app_notifications, Menu.NONE, R.string.app_notifications);
    }
}
 
開發者ID:brevent,項目名稱:prevent,代碼行數:24,代碼來源:PreventFragment.java

示例3: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    //clear menu
    if (menu.size() != 0) {
        menu.clear();
    }

    int id_view = v.getId();

    switch (id_view) {
        case R.id.arrow:
            List<Subject> subjects = getSubjectList();
            if (subjects.size() == 0) {
                FunctionHelper.makeSToast(mContext, mResources.getString(R.string.no_data_available));
            } else {
                for (Subject s : subjects) {
                    //Add menu item with groupId
                    menu.add(ID_GROUP_SUBJECT, s.getSubject_id(), s.getSubject_id(), s.getSubject_name());
                }
                menu.setHeaderTitle(R.string.choose_a_subject);
            }
            break;
    }
}
 
開發者ID:nhocga1995s,項目名稱:MyCalendar,代碼行數:26,代碼來源:WeekLessonDetailActivity.java

示例4: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    final SipProfile account = profileFromContextMenuInfo(menuInfo);
    if(account == null) {
        return;
    }
    WizardInfo wizardInfos = WizardUtils.getWizardClass(account.wizard);

    // Setup the menu header
    menu.setHeaderTitle(account.display_name);
    if(wizardInfos != null) {
        menu.setHeaderIcon(wizardInfos.icon);
    }
    
    menu.add(0, MENU_ITEM_ACTIVATE, 0, account.active ? R.string.deactivate_account
            : R.string.activate_account);
    menu.add(0, MENU_ITEM_MODIFY, 0, R.string.modify_account);
    menu.add(0, MENU_ITEM_DELETE, 0, R.string.delete_account);
    menu.add(0, MENU_ITEM_WIZARD, 0, R.string.choose_wizard);

}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:23,代碼來源:AccountsEditListFragment.java

示例5: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
{
    try
    {
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
        if (info != null)
        {
            fileListView.setSelection(info.position, 0);
        }
        menu.setHeaderTitle(R.string.fman_operation);
        AdapterIf ca = getListAdapter();
        ca.populateContextMenu(menu, info, fileListView.getSelected());
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:20,代碼來源:Commander.java

示例6: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    menu.setHeaderTitle(R.string.trans_menu_title);
    menu.add(0, 100, 0, R.string.trans_menu_changename);//groupId, itemId, order, title
    menu.add(0, 101, 0, R.string.trans_menu_viewreceiver);
    menu.add(0, 102, 0, R.string.trans_menu_openinb);
}
 
開發者ID:manuelsc,項目名稱:Lunary-Ethereum-Wallet,代碼行數:8,代碼來源:FragmentTransactionsAbstract.java

示例7: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    getMenuInflater().inflate(R.menu.folder_context, menu);

    FolderInfoHolder folder = (FolderInfoHolder) mAdapter.getItem(info.position);

    menu.setHeaderTitle(folder.displayName);
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:10,代碼來源:FolderList.java

示例8: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
        ContextMenuInfo menuInfo)
{
    Log.v(L.TAG, "ItemsListReactor.onCreateContextMenu()");
    
    AdapterContextMenuInfo ctxMenuInfo = (AdapterContextMenuInfo)menuInfo;
    ListView listView = (ListView)findViewById(R.id.ItemsListView);
    ctxItem = (ItemDesc)listView.getItemAtPosition(ctxMenuInfo.position);

    menu.setHeaderTitle("Item Options");
    menu.add(Menu.NONE, EDIT_ITEM, Menu.NONE, "Edit");
    menu.add(Menu.NONE, DELETE_ITEM, Menu.NONE, "Delete");
    String toggleText;
    if(ctxItem.isStar())
    {
        toggleText = "Remove Star";
    }
    else
    {
        toggleText = "Add Star";
    }
    menu.add(Menu.NONE, TOGGLE_STAR, Menu.NONE, toggleText);
    if(dataViewer.getListData().size() > 1)
    {
        menu.add(Menu.NONE, MOVE_ITEM, Menu.NONE, "Move To");
    }
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:29,代碼來源:SimplyDoActivity.java

示例9: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    BreventActivity activity = (BreventActivity) mFragment.getActivity();
    menu.setHeaderTitle(label);
    menu.add(Menu.NONE, R.string.context_menu_select, Menu.NONE,
            activity.getString(R.string.context_menu_select));
    menu.add(Menu.NONE, R.string.context_menu_package_name, Menu.NONE,
            activity.getString(R.string.context_menu_package_name));
    menu.add(Menu.NONE, R.string.context_menu_app_info, Menu.NONE,
            activity.getString(R.string.context_menu_app_info));
    PackageManager packageManager = mFragment.getActivity().getPackageManager();
    if (BuildConfig.APPLICATION_ID.equals(packageName)) {
        menu.add(Menu.NONE, R.string.context_menu_brevent_server_info, Menu.NONE,
                activity.getString(R.string.context_menu_brevent_server_info));
    } else if (packageManager.getLaunchIntentForPackage(packageName) != null) {
        menu.add(Menu.NONE, R.string.context_menu_open, Menu.NONE,
                activity.getString(R.string.context_menu_open));
    }
    if (activity.isBrevent(packageName)) {
        if (activity.isPriority(packageName)) {
            menu.add(Menu.NONE, R.string.context_menu_unset_priority, Menu.NONE,
                    activity.getString(R.string.context_menu_unset_priority));
        } else {
            menu.add(Menu.NONE, R.string.context_menu_set_priority, Menu.NONE,
                    activity.getString(R.string.context_menu_set_priority));
        }
    }
    if (activity.hasOps(packageName)) {
        menu.add(Menu.NONE, R.string.context_menu_appops, Menu.NONE,
                activity.getString(R.string.context_menu_appops));
    }
    int size = menu.size();
    for (int i = 0; i < size; ++i) {
        menu.getItem(i).setOnMenuItemClickListener(this);
    }
    String important = activity.getLabel("", packageName);
    if (!TextUtils.isEmpty(important)) {
        menu.add(AppsLabelLoader.trim(important));
    }
}
 
開發者ID:brevent,項目名稱:Brevent,代碼行數:41,代碼來源:AppsItemViewHolder.java

示例10: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    if (mLastSelectedQuery != null) {
        getActivity().getMenuInflater().inflate(R.menu.context_history, menu);
        menu.setHeaderTitle(mLastSelectedQuery.getData().getLocalizedName());
    }
}
 
開發者ID:hyperrail,項目名稱:hyperrail-for-android,代碼行數:9,代碼來源:LiveboardSearchFragment.java

示例11: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    if (v.getId() == android.R.id.list) {
        menu.setHeaderTitle(getResources().getText(R.string.note_context_menu));
        getMenuInflater().inflate(R.menu.context_menu, menu);
    }
}
 
開發者ID:coffeeplanter,項目名稱:SimpleNotes,代碼行數:9,代碼來源:MainActivity.java

示例12: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
    menu.setHeaderTitle((String) ((Object[])btnMore.getTag())[0]);
    Intent data = new Intent();
    data.putExtra(GroupFragment.CONTEXT_MENU_KEY_INTENT_DATA_POS, (Integer) ((Object[])btnMore.getTag())[1]);
    menu.add(Menu.NONE, GroupFragment.CONTEXT_MENU_EDIT, Menu.NONE, "Edit group").setIntent(data);
    menu.add(Menu.NONE, GroupFragment.CONTEXT_MENU_DELETE, Menu.NONE, "Delete group").setIntent(data);
    menu.add(Menu.NONE, GroupFragment.CONTEXT_MENU_LEAVE, Menu.NONE, "Leave group").setIntent(data);
}
 
開發者ID:ansarisufiyan777,項目名稱:Show_Chat,代碼行數:10,代碼來源:GroupFragment.java

示例13: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.setHeaderTitle("Select action");
    menu.add(0, 1, 1, "Edit");
    menu.add(0, 2, 2, "Delete");
}
 
開發者ID:CMPUT301F17T29,項目名稱:HabitUp,代碼行數:8,代碼來源:ViewHabitActivity.java

示例14: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.setHeaderTitle(R.string.manage_identities_context_menu_title);
    getMenuInflater().inflate(R.menu.manage_identities_context, menu);
}
 
開發者ID:philipwhiuk,項目名稱:q-mail,代碼行數:7,代碼來源:ManageIdentities.java

示例15: onCreateContextMenu

import android.view.ContextMenu; //導入方法依賴的package包/類
public void onCreateContextMenu(ContextMenu menu, View view,
                                ContextMenu.ContextMenuInfo menu_info) {
  menu.setHeaderTitle("Options");
  menu.add(0, 0, 0, "Delete");
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:6,代碼來源:Export.java


注:本文中的android.view.ContextMenu.setHeaderTitle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。