我有Image Gridview,我想添加图像ONE by ONE到gridview从图库或从相机捕获图像选择。如何使用从图库中选择的图像或从相机捕获的图像填充gridview
12
A
回答
4
你可以在你的情况下做什么总是有一个图像分配给你的网格视图的最后一项。 点击最后一个项目,你可以创建一个弹出窗口,要求你把它带到你的画廊或相机。 现在如果用户点击后退按钮或决定取消在网格视图中继续显示上次填充的“+”号图像,如果选择了任何其他选项,则可以通过在onActivityResult().
之间导航到期望的操作,如果结果代码是积极的,你可以继续:
1) Delete the last item from grid view i.e, the '+' sign image
2) Appending the image either taken from camera or gallery
3) Appending the image having '+' sign itself
始终把条件为网格视图的最后一个项目把它指向的对话框中导航到画廊或从相机点击。 对于其他物品,您可能会继续满足您的所需要求。
让我知道它是否有帮助。
感谢
2
我想下面的链接将帮助您创建...在文件夹中
+0
实际上,我正在寻找和roid UI - 动态添加按钮到Gridview http://stackoverflow.com/q/14591132/1012284 – 2013-02-11 07:26:33
1
认沽图像[图片]在SD卡
public class ChannelImageAdapter extends BaseAdapter {
int mGalleryItemBackground;
private Context mContext;
File[] images;
File[] files;
public ChannelImageAdapter(Context c, int folderID) {
mContext = c;
File dir = new File(Environment.getExternalStorageDirectory() + "/images");
files = dir.listFiles();
images = files[folderID].listFiles();
}
public int getCount() {
return images.length;
}
public Object getItem(int position) {
return images[position].getAbsolutePath();
}
public long getItemId(int position) {
return position;
}
public String getAlbumName(int folderID) {
return files[folderID].getName();
}
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
//Bitmap bm = BitmapFactory
// .decodeFile(images[position].getAbsolutePath());
if (convertView == null) {
imageView = new ImageView(mContext);
imageView.setLayoutParams(new GridView.LayoutParams(100, 100));
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setPadding(5, 10, 5, 10);
} else {
imageView = (ImageView) convertView;
}
imageView.setImageBitmap(Bitmap.decode(images[position].getAbsoluteFile()));
return imageView;
}
}
相关问题
- 1. 如何在Android中从图库或相机中选择图像?
- 2. 在android中,获取从相机捕获图像的图像ID
- 3. 如何仅从画廊中选择相机捕捉图像?
- 4. 对话框从图库或相机中挑选图像
- 5. 裁剪和调整从图库或相机中选择的图像
- 6. 使用MVP从图库/相机中获取图像
- 7. 我想创建从相机捕获的图像的缩略图
- 8. 如何从gridView获取图像(位图)
- 9. 从图库中选择多个图像
- 10. 从图库中选择多个图像
- 11. 从相机捕获图像后传递额外的意图
- 12. 使用相机的图像选择器没有使用相机图像
- 13. 识别GridView中的选择,填充图像Android
- 14. 如何获取图片的路径,从图库中选择或通过相机捕获
- 15. 如何从javafx中的图库中选择图像?
- 16. 从图像中选择图像部分?
- 17. 从图像组中选择图像
- 18. 离子图像作物,同时从图库中选择图像
- 19. 如何限制用户只从图库中选择JPG图像?
- 20. 在相机和图库之间选择图像选择
- 21. 将图像设置为图库视图而不从图库中选择图像
- 22. 无法从相机中检索捕获的图像
- 23. 从图像中选择图像并获取返回的目录
- 24. 如何从图库中获取所选图像的路径
- 25. 我如何使用android中的图像填充图像数据库?
- 26. 如何从wordpress中的图库简码获取图库图像?
- 27. 从数组中随机选择图像
- 28. 从drawable中随机选择图像
- 29. 如何从DataTable填充时禁用DataGridView图像列中的空图像
- 30. 如何使用UIImageView从阵列中选择随机图像
嘿,我有一个查询,请给我一些细节....做ü想从网格视图或所有图片库添加选定的图像是存在于画廊网格视图中显示.. .. – 2013-02-11 07:41:32