当前位置: 首页>>代码示例>>Java>>正文


Java OnCreateContextMenuListener类代码示例

本文整理汇总了Java中android.view.View.OnCreateContextMenuListener的典型用法代码示例。如果您正苦于以下问题:Java OnCreateContextMenuListener类的具体用法?Java OnCreateContextMenuListener怎么用?Java OnCreateContextMenuListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OnCreateContextMenuListener类属于android.view.View包,在下文中一共展示了OnCreateContextMenuListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setListViewContextMenuWithDel_Resume

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
private void setListViewContextMenuWithDel_Resume() {
	lvMang.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
		
		@Override
		public void onCreateContextMenu(ContextMenu menu, View v,
				ContextMenuInfo menuInfo) {
			intCurrDataPos = ((AdapterContextMenuInfo) menuInfo).position;
			menu.add(0, 0, 0, "删除");
			menu.add(0, 1, 1, "恢复所有已暂停车次");
		}
	});
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:13,代码来源:MonitorMangAty.java

示例2: onCreateContextMenu

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view,
        ContextMenuInfo menuInfo) {
    final android.view.ContextMenu nativeMenu;
    if (menu instanceof ContextMenuWrapper) {
        nativeMenu = ((ContextMenuWrapper) menu).unwrap();
        super.onCreateContextMenu(nativeMenu, view, menuInfo);
        if (view instanceof ContextMenuCallbackGetter) {
            final OnCreateContextMenuListener l = ((ContextMenuCallbackGetter) view)
                    .getOnCreateContextMenuListener();
            if (l != null) {
                l.onCreateContextMenu(nativeMenu, view, menuInfo);
            }
        }
    }
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:17,代码来源:_HoloActivity.java

示例3: initListView

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
private void initListView() {
	listView.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {

		@Override
		public void onCreateContextMenu(ContextMenu menu, View v,
				ContextMenuInfo menuInfo) {
			menu.setHeaderTitle("选择操作");
			menu.add(0, 0, 0, "修改");
			menu.add(0, 1, 1, "删除");
		}
	});

	listView.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int index,
				long itemId) {
		}
	});
}
 
开发者ID:buddyli,项目名称:PBMS,代码行数:21,代码来源:BookListActivity.java

示例4: setListViewContextMenuWithDel

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
private void setListViewContextMenuWithDel() {
	lvMang.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
		
		@Override
		public void onCreateContextMenu(ContextMenu menu, View v,
				ContextMenuInfo menuInfo) {
			intCurrDataPos = ((AdapterContextMenuInfo) menuInfo).position;
			menu.add(0, 0, 0, "删除");
		}
	});
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:12,代码来源:MonitorMangAty.java

示例5: onCreateContextMenu

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, view, menuInfo);
    if (view instanceof ContextMenuCallbackGetter) {
        final OnCreateContextMenuListener l = ((ContextMenuCallbackGetter) view)
                .getOnCreateContextMenuListener();
        if (l != null) {
            l.onCreateContextMenu(menu, view, menuInfo);
        }
    }
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:12,代码来源:_HoloActivity.java

示例6: init

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
public void init()   
{
	resolver = getContentResolver();
	bookList = DbDataOperation.getBookInfo(resolver);
	
	lvBookshelf = (ListView)findViewById(R.id.lvBookshelf);
	fileBrowser = (FileBrowser)findViewById(R.id.filebrowser);
	fileBrowser.setOnFileBrowserListener(this);
	lvBookshelf.setOnItemClickListener(this);
	ll=(RelativeLayout)findViewById(R.id.content);
	
	adapter = new CustomAdapter();
	lvBookshelf.setAdapter(adapter);
	lvBookshelf.setOnCreateContextMenuListener(new OnCreateContextMenuListener()
	{
		public void onCreateContextMenu(ContextMenu menu, View v,
				ContextMenuInfo menuInfo)
		{
			AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
			bookPosition = info.position;
			menu.add(Menu.NONE,R.id.menu_open,0,"打开");
			menu.add(Menu.NONE, R.id.menu_del, 1, "删除 " ); 
			menu.add(Menu.NONE, R.id.menu_des, 1, "详细 " ); 
		}
	});
       titleTextV=(TextView)findViewById(R.id.profile_header_title);
       titleTextV.setText("本地文件");
       backImageV=(ImageView)findViewById(R.id.profile_header_back);
       backImageV.setOnClickListener(new OnClickListener(){

               public void onClick(View arg0) {
                   // TODO Auto-generated method stub
                   ll.setVisibility(View.INVISIBLE);
               }
               
           });
}
 
开发者ID:dotcool,项目名称:coolreader,代码行数:38,代码来源:BookshelfActivity.java

示例7: onCreate

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    lvBookMark = getListView();
    resolver = getContentResolver();
    bookMarks = DbDataOperation.getBookMark(resolver);
    lvBookMark.setBackgroundResource(R.drawable.bg_listview);
    lvBookMark.setAdapter(adapter);
    lvBookMark.setDivider(null);
    lvBookMark.setCacheColorHint(000000);
    lvBookMark.setOnItemClickListener(new OnItemClickListener()
    {
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id)
        {
            currentPosition = position;
            intentToRead();
        }
    });
    lvBookMark.setOnCreateContextMenuListener(new OnCreateContextMenuListener()
    {
        public void onCreateContextMenu(ContextMenu menu, View v,
                ContextMenuInfo menuInfo)
        {
            AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
            currentPosition = info.position;
            menu.add(Menu.NONE,R.id.menu_open,0,"打开");
            menu.add(Menu.NONE, R.id.menu_del, 1, "删除 " ); 
            menu.add(Menu.NONE, R.id.menu_des, 1, "详细 " ); 
  
        }
    });
}
 
开发者ID:dotcool,项目名称:coolreader,代码行数:35,代码来源:BookmarkActivity.java

示例8: addImage

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
private void addImage(String uri, boolean temporary, String rating) {
		if (attachments.size() >= 5)
			return;
		AsyncImageView image = new AsyncImageView(this);
		image.setScaleType(ScaleType.CENTER_INSIDE);
		Bitmap b = loadBitmap(uri);
		if(b == null)
			return;
		image.setImageBitmap(b);
		image.setTag(attachments.size());
		image.setAdjustViewBounds(true);
		image.setPadding(4, 2, 4, 2);
		registerForContextMenu(image);
		image.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
			@Override
			public void onCreateContextMenu(ContextMenu menu, View v,
					ContextMenuInfo menuInfo) {
//				menu.setHeaderTitle("Select rating");
				int i;
				for (i = 0; i < ratings.length; i++) {
					menu.add(Menu.NONE, (Integer) v.getTag(), i, ratings[i]);
				}
				menu.add(Menu.NONE, (Integer) v.getTag(), i++, R.string.crop);
				menu.add(Menu.NONE, (Integer) v.getTag(), i++, R.string.resize);
				menu.add(Menu.NONE, (Integer) v.getTag(), i++, R.string.delete);
			}
		});
		LinearLayout scroll = (LinearLayout) findViewById(R.id.picsScroll);
		scroll.addView(image);
		NewPostAttachment at = new NewPostAttachment(uri, rating);
		at.setImageView(image);
		if (temporary)
			at.delete_after = true;
		attachments.add(at);
	}
 
开发者ID:rdmwfs,项目名称:dobroreader-mod,代码行数:36,代码来源:DobroNewPostActivity.java

示例9: onCreate

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.hc);
	StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary));
	toolbar = (android.support.v7.widget.Toolbar)
	    findViewById(R.id.toolbar);
//		初始化Toolbar控件
	setSupportActionBar(toolbar);
//		用Toolbar取代ActionBar
	//toolbar.setTitleTextColor(getResources().getColor(R.color.text_font_white));//标题颜色
	//	toolbar.setSubtitleTextColor(getResources().getColor(R.color.text_font_white));//副标题颜色


//		设置导航按钮监听
	//overridePendingTransition(R.anim.out_to_right, R.anim.in_from_left);
	bn_add = (Button)findViewById(R.id.bn_add);
	bn_clear = (Button)findViewById(R.id.bn_clear);
	bn_hc = (Button)findViewById(R.id.bn_hc);
	list = (GridView)findViewById(R.id.list);

	bn_add.setOnClickListener(this);
	bn_clear.setOnClickListener(this);
	bn_hc.setOnClickListener(this);
	IntentFilter intentFilter=new IntentFilter();
	intentFilter.addAction(THIS_ACTION);
	registerReceiver(br, intentFilter);
	//FileList.curpath = "/mnt/sdcard";
	FileList.curpath = Environment.getExternalStorageDirectory().getAbsolutePath();
	FileList.broadcastAction = THIS_ACTION;
	initAdapter();
	formatter = new SimpleDateFormat("yyyy-MM-dd HH_mm_ss"); 
	//广告初始化

	sp = PreferenceManager.getDefaultSharedPreferences(this);
	list.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
		@Override
		public void onCreateContextMenu(ContextMenu p1, View p2, ContextMenu.ContextMenuInfo p3)
		{
		    // TODO: Implement this method
		    //p1.setHeaderTitle("选项");
		    //第二个参数是id
		    p1.add(0, 0, 0, "设置持续时间");
		    p1.add(0, 1, 0, "移除该图片");

		}
	    });
    }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:51,代码来源:HCActivity.java

示例10: onCreate

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
	setContentView(R.layout.fj);
	StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary));
	toolbar = (android.support.v7.widget.Toolbar)
	    findViewById(R.id.toolbar);
//		初始化Toolbar控件
	setSupportActionBar(toolbar);
//		用Toolbar取代ActionBar
	//toolbar.setTitleTextColor(getResources().getColor(R.color.text_font_white));//标题颜色
	//toolbar.setSubtitleTextColor(getResources().getColor(R.color.text_font_white));//副标题颜色



//		设置导航按钮监听
	//overridePendingTransition(R.anim.out_to_right, R.anim.in_from_left);
	bn_add = (Button)findViewById(R.id.bn_add2);
	bn_clear = (Button)findViewById(R.id.bn_clear2);
	bn_hc = (Button)findViewById(R.id.bn_fj);
	list = (ListView)findViewById(R.id.list2);

	bn_add.setOnClickListener(this);
	bn_clear.setOnClickListener(this);
	bn_hc.setOnClickListener(this);
	IntentFilter intentFilter=new IntentFilter();
	intentFilter.addAction(THIS_ACTION);
	registerReceiver(br, intentFilter);
	FileList.curpath = Environment.getExternalStorageDirectory().getAbsolutePath();
	//FileList.filter = ".*.gif$";
	FileList.broadcastAction = THIS_ACTION;
	initAdapter();
	sp = PreferenceManager.getDefaultSharedPreferences(this);

	list.setOnCreateContextMenuListener(new OnCreateContextMenuListener(){
		@Override
		public void onCreateContextMenu(ContextMenu p1, View p2, ContextMenu.ContextMenuInfo p3)
		{
		    // TODO: Implement this method
		    p1.add(0, 0, 0, "移除该图片");
		}
	    });
    }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:46,代码来源:FJActivity.java

示例11: getChildView

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
@Override
	public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
			ViewGroup parent) {
		if (mLstDatas == null || mLstDatas.size() == 0){
			return null;
		}
		final int groupPos = groupPosition;
		ChildViewHolder holder;
		if (convertView != null){
			holder = (ChildViewHolder) convertView.getTag();
		}else{
			convertView = mInflater.inflate(R.layout.item_a6_order, null);
			holder = new ChildViewHolder();
			holder.slv1 = (SubListView)convertView.findViewById(R.id.item_a6_order_slv1);
			convertView.setTag(holder);
		}
		holder.slv1.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
			
			@Override
			public void onCreateContextMenu(ContextMenu menu, View v,
					ContextMenuInfo menuInfo) {
				mCurrGroupPos = groupPos;
				mCurrChildItemPos = ((AdapterContextMenuInfo) menuInfo).position;
				menu.clear();
				menu.add(A6OrderAty.CONTEXT_GROUP_0, A6OrderAty.CONTEXT_ITEM_ADD_TRAIN_INFO, 0, "添加车次");
				TicketInfo tInfo = mLstDatas.get(groupPos).getTickets().get(mCurrChildItemPos);
				try {
					Date trainDate = TimeUtil.getDTFormat().parse(tInfo.getStart_train_date_page());
					if (trainDate.getTime() >= (new Date()).getTime()){
						if (tInfo.getReturn_flag().equals("Y")){
							//退票
							menu.add(A6OrderAty.CONTEXT_GROUP_0, A6OrderAty.CONTEXT_ITEM_REFUND_TICKET, 1, "退票");
						}
//						if (tInfo.getResign_flag().equals("Y")){
//							//改签
//							menu.add(A6OrderAty.CONTEXT_GROUP_0, A6OrderAty.CONTEXT_ITEM_RESIGN, 2, "改签");
//						}
					}
				} catch (ParseException e) {
					e.printStackTrace();
				}
			}
		});
		A6OrderItemAdapter adapter = new A6OrderItemAdapter(mContext, mLstDatas.get(groupPosition).getTickets());
		holder.slv1.setAdapter(adapter);
		return convertView;
	}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:48,代码来源:A6OrderExpandableAdapter.java

示例12: setOnCreateContextMenuListener

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
/**
* @see View#setOnCreateContextMenuListener(OnCreateContextMenuListener)
*/
 public W setOnCreateContextMenuListener(OnCreateContextMenuListener l) {
     mView.setOnCreateContextMenuListener(l);
     return (W)this;
 }
 
开发者ID:AnthZh,项目名称:AndroidViewHelper,代码行数:8,代码来源:ViewWrapper.java

示例13: onCreate

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	if (MainTabActivity.isLightTheme(this)) {
		setTheme(R.style.Theme_Light);
	}
	
	super.onCreate(savedInstanceState);
	
	feedName = null;
	
	iconBytes = null;
	
	Intent intent = getIntent();
	
	feedId = intent.getLongExtra(FeedData.FeedColumns._ID, 0);
	uri = intent.getData();
	
	if (feedId > 0) {
		Cursor cursor = getContentResolver().query(FeedData.FeedColumns.CONTENT_URI(feedId), FEED_PROJECTION, null, null, null);
		
		if (cursor.moveToFirst()) {
			feedName = cursor.isNull(0) ? cursor.getString(1) : cursor.getString(0);
			iconBytes = cursor.getBlob(2);
			hideRead = cursor.getInt(3) == 1;
		}
		cursor.close();
	} else {
		hideRead = PreferenceManager.getDefaultSharedPreferences(this).getBoolean(new StringBuilder(uri.equals(FeedData.EntryColumns.FAVORITES_CONTENT_URI) ? FAVORITES : ALLENTRIES).append('.').append(FeedData.FeedColumns.HIDE_READ).toString(), false);
	}
	
	if (!MainTabActivity.POSTGINGERBREAD && iconBytes != null && iconBytes.length > 0) { // we cannot insert the icon here because it would be overwritten, but we have to reserve the icon here
		if (!requestWindowFeature(Window.FEATURE_LEFT_ICON)) {
			iconBytes = null;
		}
	}
	
	setContentView(R.layout.entries);
	
	entriesListAdapter = new EntriesListAdapter(this, uri, intent.getBooleanExtra(EXTRA_SHOWFEEDINFO, false), intent.getBooleanExtra(EXTRA_AUTORELOAD, false), hideRead);
	setListAdapter(entriesListAdapter);
	
	if (feedName != null) {
		setTitle(feedName);
	}
	if (iconBytes != null && iconBytes.length > 0) {
		int bitmapSizeInDip = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24f, getResources().getDisplayMetrics());
		Bitmap bitmap = BitmapFactory.decodeByteArray(iconBytes, 0, iconBytes.length);
		if (bitmap != null) {
			if (bitmap.getHeight() != bitmapSizeInDip) {
				bitmap = Bitmap.createScaledBitmap(bitmap, bitmapSizeInDip, bitmapSizeInDip, false);
			}
			
			if (MainTabActivity.POSTGINGERBREAD) {
				CompatibilityHelper.setActionBarDrawable(this, new BitmapDrawable(bitmap));
			} else {
				setFeatureDrawable(Window.FEATURE_LEFT_ICON, new BitmapDrawable(bitmap));
			}
		}
	}
	if (RSSOverview.notificationManager != null) {
		RSSOverview.notificationManager.cancel(0);
	}
	
	getListView().setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
		public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
			menu.setHeaderTitle(((TextView) ((AdapterView.AdapterContextMenuInfo) menuInfo).targetView.findViewById(android.R.id.text1)).getText());
			menu.add(0, CONTEXTMENU_MARKASREAD_ID, Menu.NONE, R.string.contextmenu_markasread).setIcon(android.R.drawable.ic_menu_manage);
			menu.add(0, CONTEXTMENU_MARKASUNREAD_ID, Menu.NONE, R.string.contextmenu_markasunread).setIcon(android.R.drawable.ic_menu_manage);
			//menu.add(0, CONTEXTMENU_DELETE_ID, Menu.NONE, R.string.contextmenu_delete).setIcon(android.R.drawable.ic_menu_delete);
			menu.add(0, CONTEXTMENU_COPYURL, Menu.NONE, R.string.contextmenu_copyurl).setIcon(android.R.drawable.ic_menu_share);
		}
	});
}
 
开发者ID:aceshooting,项目名称:Rss-App-for-tumblr,代码行数:74,代码来源:EntriesListActivity.java

示例14: onCreate

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setContentView(R.layout.archives_display);

	// ��Layout�����ListView
	list = (ListView) findViewById(R.id.archives_display_ListView);

	// ���ɶ�̬���飬��������
	listItem = new ArrayList<HashMap<String, Object>>();
	
	//��ȡ��Ϸ�浵
	String[] fileNames = archiveContorller.getArchiveDir();
	for(int i = 0; i<fileNames.length;i++){
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("archives_display_ItemImage", R.drawable.icon);// ͼ����Դ��ID
		//map.put("archives_display_ItemText01", "�浵 " + (i+1));
		map.put("archives_display_ItemText01", "��Ϸ�浵 ");
		map.put("archives_display_ItemText02", fileNames[i].subSequence(0, fileNames[i].length()-4));
		listItem.add(map);
	}
	
	// ������������Item�Ͷ�̬�����Ӧ��Ԫ��
	listItemAdapter = new SimpleAdapter(this, listItem,// ����Դ
			R.layout.archives_display_item,// ListItem��XMLʵ��
			// ��̬������ImageItem��Ӧ������
			new String[] { "archives_display_ItemImage",
					"archives_display_ItemText01",
					"archives_display_ItemText02" },
			// ImageItem��XML�ļ������һ��ImageView,����TextView ID
			new int[] { R.id.archives_display_ItemImage,
					R.id.archives_display_ItemText01,
					R.id.archives_display_ItemText02 });

	// ��Ӳ�����ʾ
	list.setAdapter(listItemAdapter);

	
	// ��ӵ��
	list.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			//��ô浵����
			String fileName = (String)listItem.get(arg2).get("archives_display_ItemText02");
			fileName +=".txt";
			
			//������Ϸ������Ϣ
			boolean flag = archiveContorller.readArchiveFile(fileName);
			
			//����������Ϣ
			ChineseChess.resetChessmanPosition();
			
			//��ת����Ϸ����
			Intent intent = new Intent();
			intent.setClass(ArchiveManagerActivity.this, GameViewActivity.class);
			ArchiveManagerActivity.this.startActivity(intent);
			
			//setTitle("�����" + arg2 + "����Ŀ");
		}
	});

	// ��ӳ������
	list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {

		@Override
		public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) {
			menu.setHeaderTitle("�浵ѡ��");
			menu.add(0, 0, 0, "ɾ��");
			menu.add(0, 1, 0, "ȡ��");
		}
	});
}
 
开发者ID:folee,项目名称:Bluetooth_ChineseChess,代码行数:76,代码来源:ArchiveManagerActivity.java

示例15: getOnCreateContextMenuListener

import android.view.View.OnCreateContextMenuListener; //导入依赖的package包/类
public OnCreateContextMenuListener getOnCreateContextMenuListener(); 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:2,代码来源:ContextMenuCallbackGetter.java


注:本文中的android.view.View.OnCreateContextMenuListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。