MultiImageView
多图加载,适用于与 RecyclerView 结合使用,用于博客卡片图文加载
How to
To get a Git project into your build:
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.ydslib:MultiImageView:1.0.4'
}
Share this release:
Tweet
Link That's it! The first time you request a project JitPack checks out the code, builds it and serves the build artifacts (jar, aar).
If the project doesn't have any GitHub Releases you can use the short commit hash or 'master-SNAPSHOT' as the version.
Use
use in xml file
<com.yds.library.MultiImageView
android:id="@+id/image_multi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:imgGap="3dp"
app:maxSize="9"
/>
use in java file
// local image
private int[] src = new int[]{
R.drawable.test01,R.drawable.test02,R.drawable.test03,
R.drawable.test04,R.drawable.test05,R.drawable.test06,
R.drawable.test07,R.drawable.test08,R.drawable.test09,R.drawable.test10
};
for(int i=0;i<src.length;i++){
mList.add(src[i]);
}
...
mMultiImageView.setImagesData(mList);//设置数据
// internet image
List<String> mList = new ArrayList<>();
mList.add("https://flmfxz.com/2020/04/MFStar 范模学院 Vol275 糯美子 Mini-9.jpg")
...
mMultiImageView.setImagesData(mList);
//加载图片与 MultiImageView 控件分离,这样如果想用 Glide 加载,
//则实现 IMultiImageLoader 接口就行了,具体实例可见 simple
mMultiImageView.setMultiImageLoader(new GlideLoadImage());
Attribute
app:imgGap="3dp" The image gap
app:isShowText="false" This attribute is used to control whether the prompt text is displayed
app:scaleType="center" This attribute is used to control how the picture is displayed
app:maxSize="2" The max number of image should be show
app:singleImgSize="50dp" The single Image size
test