implementation 'me.luzhuo.android:lib_image_select:1.1.16-SNAPSHOT'implementation 'androidx.appcompat:appcompat:1.2.0'implementation 'androidx.constraintlayout:constraintlayout:2.0.4'implementation 'com.github.bumptech.glide:glide:4.10.0'implementation 'com.google.android.material:material:1.2.1'implementation 'me.luzhuo.android:lib_core:2.0.8-SNAPSHOT'
1. 效果图
2. 布局编写
自定义类型 和 自定义布局 的图片选择
<me.luzhuo.lib_image_select.ImageSelectViewandroid:id="@+id/image1"app:image_flags="Images|Videos|Gif"android:layout_width="wrap_content"android:layout_height="wrap_content"app:image_layout_select_add="@layout/image_item_image_select_add"app:image_layout_select_normal="@layout/image_item_image_select_normal"/>
默认的图片选择
<me.luzhuo.lib_image_select.ImageSelectViewandroid:id="@+id/image2"android:layout_width="wrap_content"android:layout_height="wrap_content"/>
只展示
<me.luzhuo.lib_image_select.ImageSelectViewandroid:id="@+id/image3"android:layout_width="wrap_content"android:layout_height="wrap_content"app:image_only_show="true"/>
3. 代码使用
基本使用 ```java ImageSelectView selectView1 = getView().findViewById(R.id.image1); ImageSelectView selectView2 = getView().findViewById(R.id.image2); ImageSelectView selectView3 = getView().findViewById(R.id.image3);
selectView1.setOnSelectListener(new AdapterSelectListener() {
@Override
public void onSelect(List
@Overridepublic void onDelete(FileBean fileBean) { }
});
2. 自己决定图片展示 和 视频播放```javaselectView1.setOnShowListener(new OnImageShowCallbackImpl(){@Overridepublic boolean onImageCallback(FileBean image, List<FileBean> images) {Toast.makeText(requireContext(), "用自己的图片展示控件", Toast.LENGTH_SHORT).show();return true;}});
4. app:image_flags 属性
| flags | 展示的类型 |
|---|---|
| Images | 仅图片 |
| Videos | 仅视频 |
| Gif | 仅图片 + Gif图 |
| Images|Videos | 仅图片 + 视频 |
| Images|Gif | 仅图片 + Gif图 |
| Videos|Gif | 图片 + Gif图 + 视频 |
| Images|Videos|Gif | 图片 + Gif图 + 视频 |
