本文整理了Java中android.view.View.setOnCreateContextMenuListener()
方法的一些代码示例,展示了View.setOnCreateContextMenuListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.setOnCreateContextMenuListener()
方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:setOnCreateContextMenuListener
暂无
代码示例来源:origin: stackoverflow.com
public static class ViewHolder extends RecyclerView.ViewHolder implements OnCreateContextMenuListener {
TextView tvTitle;
ImageView ivImage;
public ViewHolder(View v) {
super(v);
tvTitle =(TextView)v.findViewById(R.id.item_title);
v.setOnCreateContextMenuListener(this);
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected void setOnCreateContextMenuListener(
View.OnCreateContextMenuListener onCreateContextMenuListener) {
this.onCreateContextMenuListener = onCreateContextMenuListener;
directly().setOnCreateContextMenuListener(onCreateContextMenuListener);
}
代码示例来源:origin: stackoverflow.com
/**
* Registers a context menu to be shown for the given view (multiple views
* can show the context menu). This method will set the
* {@link OnCreateContextMenuListener} on the view to this activity, so
* {@link #onCreateContextMenu(ContextMenu, View, ContextMenuInfo)} will be
* called when it is time to show the context menu.
*
* @see #unregisterForContextMenu(View)
* @param view The view that should show a context menu.
*/
public void registerForContextMenu(View view) {
view.setOnCreateContextMenuListener(this);
}
代码示例来源:origin: com.google.android/support-v4
/**
* Prevents a context menu to be shown for the given view. This method will
* remove the {@link OnCreateContextMenuListener} on the view.
*
* @see #registerForContextMenu(View)
* @param view The view that should stop showing a context menu.
*/
public void unregisterForContextMenu(View view) {
view.setOnCreateContextMenuListener(null);
}
代码示例来源:origin: stackoverflow.com
vi.setOnCreateContextMenuListener(this);
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View vi = convertView;
vi.setOnCreateContextMenuListener(this);
}
代码示例来源:origin: kingargyle/adt-leanback-support
/**
* Prevents a context menu to be shown for the given view. This method will
* remove the {@link OnCreateContextMenuListener} on the view.
*
* @see #registerForContextMenu(View)
* @param view The view that should stop showing a context menu.
*/
public void unregisterForContextMenu(View view) {
view.setOnCreateContextMenuListener(null);
}
代码示例来源:origin: derry/delion
/**
* Sets the view that will display this item. MostVisitedItem will handle clicks on the view.
* This should be called exactly once.
*/
public void initView(View view) {
assert mView == null;
mView = view;
mView.setOnClickListener(this);
mView.setOnCreateContextMenuListener(this);
}
代码示例来源:origin: stackoverflow.com
public ViewHolder(View v) {
super(v);
v.setOnCreateContextMenuListener(this);
v.setOnLongClickListener(this);
}
代码示例来源:origin: stackoverflow.com
public static class ViewHolder extends RecyclerView.ViewHolder implements OnCreateContextMenuListener {
TextView tvTitle;
ImageView ivImage;
public ViewHolder(View v) {
super(v);
tvTitle =(TextView)v.findViewById(R.id.item_title);
v.setOnCreateContextMenuListener(this);
}
代码示例来源:origin: andstatus/andstatus
private void setContextMenuTo(int viewId) {
View view = profileView.findViewById(viewId);
view.setOnCreateContextMenuListener(contextMenu);
view.setOnClickListener(View::showContextMenu);
}
代码示例来源:origin: hieuapp/android-firebase-chat
public ItemGroupViewHolder(View itemView) {
super(itemView);
itemView.setOnCreateContextMenuListener(this);
iconGroup = (TextView) itemView.findViewById(R.id.icon_group);
txtGroupName = (TextView) itemView.findViewById(R.id.txtName);
btnMore = (ImageButton) itemView.findViewById(R.id.btnMoreAction);
}
代码示例来源:origin: SecUSo/privacy-friendly-todo-list
public ViewHolder(View v) {
super(v);
title = (TextView) v.findViewById(R.id.tv_todo_list_title);
deadline = (TextView) v.findViewById(R.id.tv_todo_list_next_deadline);
done = (TextView) v.findViewById(R.id.tv_todo_list_status);
urgency = v.findViewById(R.id.v_urgency_indicator);
v.setOnClickListener(this);
v.setOnCreateContextMenuListener(this);
}
代码示例来源:origin: pkhope/weibo
public TextViewHolder(View itemView) {
super(itemView);
rootView = itemView;
avatar = (ImageView) itemView.findViewById(R.id.avatar);
nickname = (TextView) itemView.findViewById(R.id.nickname);
time = (TextView) itemView.findViewById(R.id.time);
content = (EmojiTextView) itemView.findViewById(R.id.content);
itemView.setOnCreateContextMenuListener(this);
itemView.setOnClickListener(this);
avatar.setOnClickListener(this);
}
代码示例来源:origin: stackoverflow.com
@Override
public void onClick(final View view, int position, MotionEvent e) {
View menuButton = view.findViewById(R.id.menu);
if (isViewClicked(e, menuButton)) {
menuButton.setOnCreateContextMenuListener(this);
menuButton.showContextMenu();
return;
}
...
}
代码示例来源:origin: org.robolectric/framework
@Implementation
public void setOnCreateContextMenuListener(View.OnCreateContextMenuListener onCreateContextMenuListener) {
this.onCreateContextMenuListener = onCreateContextMenuListener;
directly().setOnCreateContextMenuListener(onCreateContextMenuListener);
}
代码示例来源:origin: org.robolectric/shadows-core
@Implementation
public void setOnCreateContextMenuListener(View.OnCreateContextMenuListener onCreateContextMenuListener) {
this.onCreateContextMenuListener = onCreateContextMenuListener;
directly().setOnCreateContextMenuListener(onCreateContextMenuListener);
}
代码示例来源:origin: org.robolectric/shadows-core-v23
@Implementation
public void setOnCreateContextMenuListener(View.OnCreateContextMenuListener onCreateContextMenuListener) {
this.onCreateContextMenuListener = onCreateContextMenuListener;
directly().setOnCreateContextMenuListener(onCreateContextMenuListener);
}
代码示例来源:origin: org.robolectric/shadows-framework
@Implementation
protected void setOnCreateContextMenuListener(
View.OnCreateContextMenuListener onCreateContextMenuListener) {
this.onCreateContextMenuListener = onCreateContextMenuListener;
directly().setOnCreateContextMenuListener(onCreateContextMenuListener);
}
代码示例来源:origin: stackoverflow.com
private class ChipViewHolder extends RecyclerView.ViewHolder implements View.OnCreateContextMenuListener {
public ChipViewHolder(View itemView) {
super(itemView);
itemView.setOnCreateContextMenuListener(this);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
menu.setHeaderTitle("Select The Action");
menu.add(0, ACTION_1_ID, getAdapterPosition(), "action 1");
menu.add(0, ACTION_2_ID, getAdapterPosition(), "action 2");
}
}
代码示例来源:origin: andstatus/andstatus
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView == null ? newView() : convertView;
view.setOnCreateContextMenuListener(contextMenu);
view.setOnClickListener(this);
setPosition(view, position);
ActorViewItem item = getItem(position);
populator.populateView(view, item, position);
return view;
}
内容来源于网络,如有侵权,请联系作者删除!