本文整理汇总了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]);
}
}
示例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);
}
}
示例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;
}
}
示例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);
}
示例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();
}
}
示例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);
}
示例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);
}
示例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");
}
}
示例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));
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
示例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");
}
示例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);
}
示例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");
}