本文整理汇总了Java中android.support.v7.widget.PopupMenu.OnMenuItemClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java PopupMenu.OnMenuItemClickListener方法的具体用法?Java PopupMenu.OnMenuItemClickListener怎么用?Java PopupMenu.OnMenuItemClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.PopupMenu
的用法示例。
在下文中一共展示了PopupMenu.OnMenuItemClickListener方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupRecyclerView
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public HorizontalBookRecyclerView setupRecyclerView(BookCardEventsCallback mListener,
Cursor bookListCursor,
String title,
PopupMenu.OnMenuItemClickListener onMenuItemClickListener,
int moreMenuRes) {
setupRecyclerView(mListener, bookListCursor);
setTitleText(title);
setOverFlowMenuListener(onMenuItemClickListener, moreMenuRes);
return this;
}
示例2: setOverFlowMenuListener
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public void setOverFlowMenuListener(PopupMenu.OnMenuItemClickListener onClickListener, int moreMenuRes) {
if (moreMenuRes > 0) {
findViewById(R.id.more_overflow).setOnClickListener(v -> {
PopupMenu popup = new PopupMenu(getContext(), v);
popup.setOnMenuItemClickListener(onClickListener);
popup.inflate(moreMenuRes);
popup.show();
});
}
}
示例3: DocumentViewModel
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public DocumentViewModel(Context context, String fileName) {
this.context = context;
this.fileName = fileName;
repository = DocumentRepository.getInstance();
rectString = context.getString(R.string.rect);
triangleString = context.getString(R.string.triangle);
ovalString = context.getString(R.string.oval);
rectLayers = new ArrayList<>();
triangleLayers = new ArrayList<>();
ovalLayers = new ArrayList<>();
onMenuItemClickListener = new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
String title = (String) item.getTitle();
if (title.equals(rectString)) {
addRectLayer();
} else if (title.equals(triangleString)) {
addTriangleLayer();
} else if (title.equals(ovalString)) {
addOvalLayer();
}
return true;
}
};
this.document = new Document();
}
示例4: getPageOptionsMenuOnItemClickListener
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
@Override
public PopupMenu.OnMenuItemClickListener getPageOptionsMenuOnItemClickListener() {
return item -> {
if (item.getItemId() == R.id.menu_help) {
openHelp();
}
return false;
};
}
示例5: showPopupMenu
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
/**
* 显示Popup菜单
*
* @param context 上下文
* @param v 视图
* @param menu 菜单资源文件
* @param listener 菜单项目点击监听器
*/
public static void showPopupMenu(@NonNull Context context, @NonNull View v, @MenuRes int menu,
@NonNull PopupMenu.OnMenuItemClickListener listener) {
//新建PopupMenu对像
PopupMenu popupMenu = new PopupMenu(context, v);
//生成Menu视图
popupMenu.getMenuInflater().inflate(menu, popupMenu.getMenu());
//setOnMenuItemClickListener
popupMenu.setOnMenuItemClickListener(listener);
//显示PopupMenu
popupMenu.show();
}
示例6: getOnMenuItemClickListener
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public PopupMenu.OnMenuItemClickListener getOnMenuItemClickListener() {
return onMenuItemClickListener;
}
示例7: getPageOptionsMenuOnItemClickListener
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public PopupMenu.OnMenuItemClickListener getPageOptionsMenuOnItemClickListener() {
return null;
}
示例8: withOnMenuItemClickListener
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public OverflowMenuDrawerItem withOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener onMenuItemClickListener) {
this.mOnMenuItemClickListener = onMenuItemClickListener;
return this;
}
示例9: getOnMenuItemClickListener
import android.support.v7.widget.PopupMenu; //导入方法依赖的package包/类
public PopupMenu.OnMenuItemClickListener getOnMenuItemClickListener() {
return mOnMenuItemClickListener;
}