ANDROID GRIDVIEW仿微信图片多选功能_显示本地相册图片多选效果

前段时间我分享过一个多图选择器实现了批示图片选择的问题、能够不会把系统的图库html

一张一张的选择要上传的图片 http://dwtedx.com/itshare_171.html微信

那么今天再和你们分享一个很是棒的源代码、实现仿微信的图片选择功能(多图选择哦)ide

话很少说、有图有真像、先上图片布局

Android仿微信图片多选功能效果

本例子主要实现了如下功能点this

一、默认显示图片最多的文件夹图片、以及底部显示图片总数量spa

二、点击底部、弹出popupWindow、popupWindow包含全部含有图片的文件夹、以及显示每一个文件夹中图片数量code

三、选择任何文件夹、进入该文件夹图片显示、能够点击选择图片、固然了、点击已选择的图片则会取消选择orm

代码分析htm

初始化展现文件夹的popupWindw事件

private void initListDirPopupWindw(){
	mListImageDirPopupWindow = new ListImageDirPopupWindow(
		LayoutParams.MATCH_PARENT, (int) (mScreenHeight * 0.7),
		mImageFloders, LayoutInflater.from(getApplicationContext())
				.inflate(R.layout.list_dir, null));
	mListImageDirPopupWindow		.setOnDismissListener(new OnDismissListener()
	{
		@Override
		public void onDismiss()
		{
			// 设置背景颜色变暗
			WindowManager.LayoutParams lp = getWindow()
				.getAttributes();
			lp.alpha = 1.0f;
			getWindow().setAttributes(lp);
		}
	});
	// 设置选择文件夹的回调
	mListImageDirPopupWindow.setOnImageDirSelected(this);}

为底部的布局设置点击事件、弹出popupWindow

private void initEvent(){mBottomLy.setOnClickListener(new OnClickListener(){
	@Override
	public void onClick(View v)
	{
		mListImageDirPopupWindow			.setAnimationStyle(R.style.anim_popup_dir);
		mListImageDirPopupWindow			.showAsDropDown(mBottomLy, 0, 0);

		// 设置背景颜色变暗
		WindowManager.LayoutParams lp = getWindow()
			.getAttributes();
		lp.alpha = .3f;
		getWindow().setAttributes(lp);
	}});}

代码就贴到这里哈、更多代码你们能够下载源代码进行查看哈

源代码下载连接: http://dwtedx.com/download.html?bdkey=s/1eQEKNqq 密码: kd1s

有任何疑问或要获取更多代码、能够在下面进行评论哈

或者你也能够给我留言: http://dwtedx.com/message_1.html

相关文章
相关标签/搜索