Git Product home page Git Product logo

hqs-common-imagebrowser-android's Introduction

Android 图片浏览器

简单的Android浏览器

运行效果图

运行效果图

安装说明

Gradle

    compile 'com.hqs.common.helper.imagebrowser:imagebrowser:1.1.19'

关于代码混淆

如果在缩放图片时出现莫名其妙的bug,由于使用了类的反射机制, 需要注意代码混淆

请在项目的混淆文件如:proguard-rules.pro中添加如下代码
-keep class com.bm.library.** {*;}
使用方法, 以RecyclerView的adapter为例, 详情请查看Demo, 以下为核心代码

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {

    MyViewHolder myViewHolder = (MyViewHolder) holder;
    myViewHolder.imageView.setImageDrawable(Drawable.createFromPath(files.get(position)));

    myViewHolder.imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            // 生成图片源数据
            
            ArrayList<QImage> imgs = new ArrayList<>();

            for (int i = 0; i < files.size(); i++) {
                QImage qImage = new QImage();
                qImage.filePathOrUrl = files.get(i);

                if(i == position){
                    qImage.srcImageView = (ImageView) v;
                }

                imgs.add(qImage);
            }
            
            // 设置占位图片
            ImageBrowser.placeHolderImageRes = R.mipmap.ic_launcher;
            // 开始浏览图片
            ImageBrowser.showWithImages(LocalImageActivity.this, imgs, position);

        }
    });
}


hqs-common-imagebrowser-android's People

Contributors

hqs5678 avatar

Stargazers

 avatar  avatar

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.