PhotoView简单使用

//依赖
implementation ‘com.zftlive.android.library:feature-android-imageloader:1.0.0’
//导入到工程里面

maven { url ‘https://jitpack.io’ }

//创建一个Activity你面布局是

Photoview 的布局

代码

public class PhotoViewActivity extends AppCompatActivity {

    PhotoView pht;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_photo_view);
        pht=findViewById(R.id.pho);
        EventBus.getDefault().register(this);
    }
    @Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
    public void settext(String image){
        Glide.with(PhotoViewActivity.this).load(image).into(pht);
        ImageLoader instance = ImageLoader.getInstance();
        instance.init(ImageLoaderConfiguration.createDefault(PhotoViewActivity.this));
        instance.displayImage(image,pht);
    }
}

你可能感兴趣的:(学习)