1 Star 0 Fork 117

radish / MultiImageSelector

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README_zh.md 2.87 KB
一键复制 编辑 原始数据 按行查看 历史
sleepingAnt 提交于 2015-05-13 22:59 . 完善文档。

MultiImageSelector

仿微信实现多图选择。支持单选和多选两种模式

###截图 Example1 Select1 Select2 Select3 Select4


###运行DEMO

./gradlew installDebug

###快速开始

  • 第0步 把模块 multi-image-selector 作为你的项目依赖添加到工程中.

  • 第1步 在你的 AndroidManifest.xml 文件中添加权限 android.permission.READ_EXTERNAL_STORAGE. 别忘了同时在 AndroidManifest.xml 中声明 MultiImageSelectorActivityPreviewPicturesActivity 这两个Activity.

        <activity
            android:name="me.nereo.multi_image_selector.PreviewPicturesActivity"
            android:configChanges="orientation|screenSize" />
        <activity
            android:name="me.nereo.multi_image_selector.MultiImageSelectorActivity"
            android:configChanges="orientation|screenSize" />
  • 第2步 代码中调用,例如:
     //yourActivity-Activity,requestCode-requestCode,maxNum-最多选择的图片数,selectedMode-选择模式(单选/多选)
     MultiImageSelectorActivity.startSelect(yourActivity, requestCode, maxNum, selectedMode);
  • 第3步 在你的 onActivityResult 方法中接受结果. 例如:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(requestCode == REQUEST_IMAGE){
        if(resultCode == RESULT_OK){
            // 获取返回的图片列表
            List<String> path = data.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT);
            // 处理你自己的逻辑 ....
        }
    }
}
  • 第4步 没第4步了,就这样就OK啦~ :)

  • 具体可以参考MultiImageSelectorActivity.java的实现

###感谢

  • square-picasso A powerful image downloading and caching library for Android
  • lovetuzitong-MultiImageSelector 此项目根据lovetuzitong-MultiImageSelector修改而来,修复了一些BUG,去掉了拍照功能(如果你需要也可以根据原项目添加)

###License

The MIT License (MIT)

Copyright (c) 2015 Nereo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

1
https://gitee.com/radish0451/MultiImageSelector.git
git@gitee.com:radish0451/MultiImageSelector.git
radish0451
MultiImageSelector
MultiImageSelector
master

搜索帮助