Android 图片选择、预览、九宫格图片控件、拖拽排序九宫格图片控件
将 MeiqiaSDK-Android 里的图库单独抽出来开源,将其中的 GridView、ListView 和 RelativeLayout 换成 RecyclerView 和 Toolbar,方便在以后的项目中直接依赖使用。Demo 中模仿了微信朋友圈的部分功能,详细用法请查看 Demo。希望能该库帮正在做这几个功能的猿友节省开发时间。
| Demo | 自定义 |
|---|---|
| 自定义 | 自定义 |
|---|---|
点击下载 BGAPhotoPickerDemo.apk 或扫描下面的二维码安装
maven { url 'https://jitpack.io' } 添加到 root build.gradle 的 repositories 中由于需要支持微博长图预览,该库中已经引入了 PhotoView 的源码并进行了修改,所以你的项目中就不要再重复引入 PhotoView 了
…
BGAPhotoPickerActivity - 选择图片
…
BGAPhotoPickerActivity - 获取已选择的图片集合
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == RC_CHOOSE_PHOTO) {
List<String> selectedPhotos = BGAPhotoPickerActivity.getSelectedPhotos(data);
}
}
BGAPhotoPickerPreviewActivity - 预览已选择的图片
Intent photoPickerPreviewIntent = new BGAPhotoPickerPreviewActivity.IntentBuilder(this)
.previewPhotos(models) // 当前预览的图片路径集合
.selectedPhotos(models) // 当前已选中的图片路径集合
.maxChooseCount(mPhotosSnpl.getMaxItemCount()) // 图片选择张数的最大值
.currentPosition(position) // 当前预览图片的位置
.isFromTakePhoto(false) // 是否是拍完照后跳转过来
.build();
startActivityForResult(photoPickerPreviewIntent, RC_PHOTO_PREVIEW);
BGAPhotoPickerPreviewActivity - 获取预览界面已选择的图片集合
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_PHOTO_PREVIEW) {
// 在预览界面按返回也会回传预览界面已选择的图片集合
List<String> selectedPhotos = BGAPhotoPickerPreviewActivity.getSelectedPhotos(data);
}
}
BGAPhotoPreviewActivity - 图片预览
…
…
…
| 个人主页 | 邮箱 |
|---|---|
| bingoogolapple.cn | [email protected] |
| 个人微信号 | 微信群 | 公众号 |
|---|---|---|
| 个人 QQ 号 | QQ 群 |
|---|---|
如果您觉得 BGA 系列开源库或工具软件帮您节省了大量的开发时间,可以扫描下方的二维码打赏支持。您的支持将鼓励我继续创作,打赏后还可以加我微信免费开通一年 上帝小助手浏览器扩展/插件开发平台 的会员服务
| 微信 | 支付宝 | |
|---|---|---|
Copyright 2016 bingoogolapple
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
No open issues yet, or sync has not completed.