Android 长按setOnItemLongClickListener 显示context Menu(上下文菜单)

Android 长按setOnItemLongClickListener  显示context Menu(上下文菜单) 例子...

 

private ListView fileList;

 

 

		fileList
				.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {

					@Override
					public void onCreateContextMenu(ContextMenu menu, View v,
							ContextMenuInfo info) {
						// TODO Auto-generated method stub
						menu.setHeaderTitle(R.string.contentMenu);
						menu.add(0, AndBoxConstant.OPEN, 0, R.string.open);
						menu.add(0, AndBoxConstant.PROPERTIY, 6,
								R.string.properties);
					}

				});

 

 

			fileList.setOnItemLongClickListener(new OnItemLongClickListener() {

				@Override
				public boolean onItemLongClick(AdapterView ada, View view,
						int index, long longIndex) {
					fileList.showContextMenu();
					return true;
				}

			});

 

你可能感兴趣的:(android)