本文整理了Java中android.support.v7.widget.PopupMenu.getMenuInflater()
方法的一些代码示例,展示了PopupMenu.getMenuInflater()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PopupMenu.getMenuInflater()
方法的具体详情如下:
包路径:android.support.v7.widget.PopupMenu
类名称:PopupMenu
方法名:getMenuInflater
暂无
代码示例来源:origin: seven332/EhViewer
PopupMenu popup = new PopupMenu(context, mOtherActions, Gravity.TOP);
mPopupMenu = popup;
popup.getMenuInflater().inflate(R.menu.scene_gallery_detail, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
代码示例来源:origin: chrisk44/Hijacker
void showSortingPopup(View v){
PopupMenu popup = new PopupMenu(getActivity(), v);
popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());
popup.getMenu().add(0, SORT_NOSORT, 0, sort_texts[SORT_NOSORT]);
popup.getMenu().add(0, SORT_ESSID, 1, sort_texts[SORT_ESSID]);
popup.getMenu().add(0, SORT_BEACONS_FRAMES, 2, sort_texts[SORT_BEACONS_FRAMES]);
popup.getMenu().add(0, SORT_DATA_FRAMES, 3, sort_texts[SORT_DATA_FRAMES]);
popup.getMenu().add(0, SORT_PWR, 4, sort_texts[SORT_PWR]);
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(android.view.MenuItem item) {
temp_sort = item.getItemId();
sortSelectBtn.setText(sort_texts[temp_sort]);
return true;
}
});
popup.show();
}
}
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
public void showPopup(View v, Context c) {
PopupMenu popup = new PopupMenu(c, v);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_card_walking_mode, popup.getMenu());
popup.getMenu().findItem(R.id.menu_set_active).setChecked(isActive);
popup.setOnMenuItemClickListener(this);
popup.show();
}
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
public void showPopup(View v, Context c) {
PopupMenu popup = new PopupMenu(c, v);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_card_training_session, popup.getMenu());
popup.setOnMenuItemClickListener(this);
popup.show();
}
代码示例来源:origin: anyaudio/anyaudio-android-app
private void showExploreItemPopUpMenu(View view, final String v_id, final String youtubeId, final String title, final String artist) {
PopupMenu popup = new PopupMenu(this, view);
popup.getMenuInflater().inflate(R.menu.explore_card_popup, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
onAddToQueue(v_id, youtubeId, title, artist);
ToastMaker.getInstance(AnyAudioActivity.this).toast("\"" + title + "\" Added To Queue");
return true;
}
});
popup.show();
}
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
public void showPopup(View v, Context c) {
PopupMenu popup = new PopupMenu(c, v);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_card_motivation_text, popup.getMenu());
popup.setOnMenuItemClickListener(this);
popup.show();
}
代码示例来源:origin: owntracks/android
public void onTlsCaCrtNameClick(final View v) {
PopupMenu popup = new PopupMenu(v.getContext(), v);
popup.getMenuInflater().inflate(R.menu.picker, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
if (item.getItemId() == R.id.clear) {
setTlsCaCrtName(null);
} else if (item.getItemId() == R.id.select) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
try {
navigator.startActivityForResult(Intent.createChooser(intent, "Select a file"), REQUEST_CODE_FILE_CA_CRT);
} catch (android.content.ActivityNotFoundException ex) {
// Potentially direct the user to the Market with a Dialog
}
}
return true;
}
});
popup.show();
}
代码示例来源:origin: zfman/hputimetable
@OnClick(R.id.id_main_menu)
public void showPopMenu(){
//创建弹出式菜单对象(最低版本11)
PopupMenu popup = new PopupMenu(context, menuImageView);//第二个参数是绑定的那个view
//获取菜单填充器
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.main_menu, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()){
case R.id.id_menu2:
ActivityTools.toActivityWithout(context,AddTimetableActivity.class);
break;
}
return false;
}
});
popup.show(); //这一行代码不要忘记了
}
代码示例来源:origin: fasteque/rgb-tool
private void showPopupMenu(View view) {
final int colorId = (int) view.getTag();
PopupMenu popup = new PopupMenu(view.getContext(), view);
popup.getMenuInflater().inflate(R.menu.color_popup, popup.getMenu());
popup.setOnMenuItemClickListener(menuItem -> {
switch (menuItem.getItemId()) {
case R.id.menu_remove:
EventBus.getDefault().post(new ColorDeleteEvent(colorId));
return true;
case R.id.menu_share:
EventBus.getDefault().post(new ColorShareEvent(colorId));
return true;
}
return false;
});
popup.show();
}
}
代码示例来源:origin: burgessjp/GanHuoIO
@Override
public void onClick(View v) {
PopupMenu popupMenu = new PopupMenu(SearchActivity.this, mIvSelectCate);
popupMenu.getMenuInflater()
.inflate(R.menu.menu_category, popupMenu.getMenu());
popupMenu.show();
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
mKeywordText.setHint(item.getTitle());
return true;
}
});
}
});
代码示例来源:origin: owntracks/android
public void onTlsClientCrtNameClick(final View v) {
PopupMenu popup = new PopupMenu(v.getContext(), v);
popup.getMenuInflater().inflate(R.menu.picker, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
if (item.getItemId() == R.id.clear) {
setTlsClientCrtName(null);
} else if (item.getItemId() == R.id.select) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
try {
navigator.startActivityForResult(Intent.createChooser(intent, "Select a file"), REQUEST_CODE_FILE_CLIENT_CRT);
} catch (android.content.ActivityNotFoundException ex) {
// Potentially direct the user to the Market with a Dialog
}
}
return true;
}
});
popup.show();
}
代码示例来源:origin: zfman/hputimetable
/**
* 显示弹出菜单
*/
@OnClick(R.id.id_webview_help)
public void showPopmenu() {
PopupMenu popup = new PopupMenu(this, helpView);
popup.getMenuInflater().inflate(R.menu.menu_webview2, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.top1:
layout.setVisibility(View.VISIBLE);
break;
case R.id.top2:
webView.loadUrl(url);
break;
default:
break;
}
return true;
}
});
popup.show();
}
代码示例来源:origin: niugao/RecyclerListTreeView
@Override
public void onClick(View v) {
int nodePlaneIndex = getAdapterPosition();
ListTree.TreeNode node = tree.getNodeByPlaneIndex(nodePlaneIndex);
currentNode=node;
PopupMenu popup = new PopupMenu(v.getContext(), v);
popup.setOnMenuItemClickListener(itemMenuClickListener);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_item, popup.getMenu());
popup.show();
}
});
代码示例来源:origin: yydcdut/RxMarkdown
@Override
public void onClick(View v) {
PopupMenu popup = new PopupMenu(getContext(), mTargetImageView);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_popup, popup.getMenu());
popup.setOnMenuItemClickListener(this);
popup.show();
}
代码示例来源:origin: anyaudio/anyaudio-android-app
public void showAutoPlayItemPopUp(View view, final String v_id, final String youtubeId, final String title, final String artist) {
PopupMenu popup = new PopupMenu(this, view);
popup.getMenuInflater().inflate(R.menu.autoplay_item_popup, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if(item.getItemId()==R.id.addAutoPlayToQueue){
onAddToQueue(v_id, youtubeId, title, artist);
}else{
//download item
showDownloadDialog(v_id, title,getImageUrl(youtubeId), artist);
}
return true;
}
});
popup.show();
}
代码示例来源:origin: brianwernick/RecyclerExt
/**
* Shows the menu specified with the <code>menuResourceId</code> starting
* at the <code>anchor</code>
*
* @param anchor The view to show the popup menu from
* @param menuResourceId The resource id for the menu to show
*/
protected void showMenu(@NonNull View anchor, @MenuRes int menuResourceId) {
PopupMenu menu = new PopupMenu(anchor.getContext(), anchor);
MenuInflater inflater = menu.getMenuInflater();
inflater.inflate(menuResourceId, menu.getMenu());
onPreparePopupMenu(menu.getMenu());
menu.setOnMenuItemClickListener(this);
menu.show();
}
代码示例来源:origin: SecUSo/privacy-friendly-pedometer
public void showPopup(View v, Context c) {
PopupMenu popup = new PopupMenu(c, v);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.menu_card_activity_summary, popup.getMenu());
popup.setOnMenuItemClickListener(this);
if (mItemClickListener != null) {
mItemClickListener.setActivityChartDataTypeChecked(popup.getMenu());
}
popup.show();
}
代码示例来源:origin: owntracks/android
private void showPopupMenu(View v) {
PopupMenu popupMenu = new PopupMenu(this, v, Gravity.START); //new PopupMenu(this, v);
popupMenu.getMenuInflater().inflate(R.menu.menu_popup_contacts, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(this);
if (preferences.getModeId() == MessageProcessorEndpointHttp.MODE_ID)
popupMenu.getMenu().removeItem(R.id.menu_clear);
popupMenu.show();
}
代码示例来源:origin: xbmc/Kore
@Override
public void onClick(final View v) {
final PlaylistType.Item playListItem = new PlaylistType.Item();
playListItem.episodeid = (int)v.getTag();
final PopupMenu popupMenu = new PopupMenu(getActivity(), v);
popupMenu.getMenuInflater().inflate(R.menu.musiclist_item, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_play:
MediaPlayerUtils.play(TVShowProgressFragment.this, playListItem);
return true;
case R.id.action_queue:
MediaPlayerUtils.queue(TVShowProgressFragment.this, playListItem, PlaylistType.GetPlaylistsReturnType.VIDEO);
return true;
}
return false;
}
});
popupMenu.show();
}
};
代码示例来源:origin: Pixplicity/letterpress
private void showPopupMenu(View anchorView) {
PopupMenu popup = new PopupMenu(MainActivity.this, anchorView);
popup.getMenuInflater().inflate(R.menu.menu, popup.getMenu());
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
// ...
return true;
}
});
// Apply custom font to popup menu
FontUtil.applyTypeface(popup.getMenu(), mTypeface);
popup.show();
}
内容来源于网络,如有侵权,请联系作者删除!