本文整理汇总了Java中android.view.View.showContextMenu方法的典型用法代码示例。如果您正苦于以下问题:Java View.showContextMenu方法的具体用法?Java View.showContextMenu怎么用?Java View.showContextMenu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.showContextMenu方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showContextMenu
import android.view.View; //导入方法依赖的package包/类
/**
* Starts showing a context menu for {@code view} based on {@code params}.
* @param contentViewCore The {@link ContentViewCore} to show the menu to.
* @param params The {@link ContextMenuParams} that indicate what menu items to show.
*/
@CalledByNative
private void showContextMenu(ContentViewCore contentViewCore, ContextMenuParams params) {
final View view = contentViewCore.getContainerView();
if (view == null
|| view.getVisibility() != View.VISIBLE
|| view.getParent() == null) {
return;
}
mCurrentContextMenuParams = params;
view.setOnCreateContextMenuListener(this);
if (view.showContextMenu()) {
WebContents webContents = contentViewCore.getWebContents();
RecordHistogram.recordBooleanHistogram(
"ContextMenu.Shown", webContents != null);
}
}
示例2: onClick
import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
if (v instanceof CardView) {
v.showContextMenu();
} else if (v instanceof ImageView) {
if (v.getId() == R.id.icon) {
onSelected((CardView) v.getParent().getParent());
}
}
}
示例3: openContextMenu
import android.view.View; //导入方法依赖的package包/类
/**
* Programmatically opens the context menu for a particular {@code view}.
* The {@code view} should have been added via
* {@link #registerForContextMenu(View)}.
*
* @param view The view to show the context menu for.
*/
public void openContextMenu(View view) {
view.showContextMenu();
}