onCreate() メソッドのコードのセクションは次のとおりです。
LayoutX = (LinearLayout) findViewById(R.id.LL_SomeName);
LayoutX.setClickable(true);
registerForContextMenu(LayoutX);
ここに残りのコードがあります
CreateContextMenu
@Override
public void onCreateContextMenu(ContextMenu M, View V, ContextMenuInfo CMI) {
super.onCreateContextMenu(M, V, CMI);
M.setHeaderTitle("My Title Here");
M.add(0, V.getId(), 0, "Menu 1");
M.add(0, V.getId(), 0, "Menu 2");
}
項目選択済み
@Override
public boolean onContextItemSelected(MenuItem Item) {
Toast.makeText(getApplicationContext(), Item.getTitle(), Toast.LENGTH_LONG).show();
}
コンテキスト メニューがまったく表示されません。何か不足していますか?