GithubHelp home page GithubHelp logo

hhy5277 / combinebitmap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shehuan/combinebitmap

0.0 2.0 0.0 1.76 MB

Android 仿钉钉、微信 群聊组合头像

License: Apache License 2.0

Java 100.00%

combinebitmap's Introduction

NiceImageView

效果预览

功能

  • 生成类似钉钉、微信 群聊组合头像Bitmap
  • 可使用图片资源id、bitmap或者使用url从网络加载,传入对应数组即可
  • 网络加载时支持线程池
  • 支持磁盘缓存、内存缓存。(记得申请磁盘缓存需要的文件存储权限
  • 对图片资源进行采样率压缩
  • ......

基本用法

Step 1. 添加JitPack仓库 在项目根目录下的 build.gradle 中添加仓库:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Step 2. 添加项目依赖

dependencies {
    implementation 'com.github.Othershe:CombineBitmap:1.0.0'
}

Step 3. 配置

CombineBitmap.init(context)
    .setLayoutManager() // 必选, 设置图片的组合形式,支持WechatLayoutManager、DingLayoutManager
    .setSize() // 必选,组合后Bitmap的尺寸,单位dp
    .setGap() // 单个Bitmap之间的距离,单位dp,默认0dp
    .setGapColor() // 单个Bitmap间距的颜色,默认白色
    .setPlaceholder() // 单个Bitmap加载失败的默认显示图片
    .setUrls() // 要加载的图片url数组
    .setBitmaps() // 要加载的图片bitmap数组
    .setResourceIds() // 要加载的图片资源id数组
    .setImageView() // 直接设置要显示图片的ImageView
    .setProgressListener(new ProgressListener() { // 加载进度的回调函数,如果不使用setImageView()方法,可在onComplete()完成最终图片的显示
        @Override
        public void onStart() {

        }

        @Override
        public void onComplete(Bitmap bitmap) {

        }
    })
    .build();

由于生成的组合Bitmap是矩形的,要实现钉钉的圆形显示效果,这里用到了一个可圆形显示的ImageView控件:NiceImageView

combinebitmap's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.