PhotoView是一个很棒的开源组件,可以伸缩图片,双击放大,单击返回等一系列常用功能,具体实现如下:
@Override
public View instantiateItem(ViewGroup container, int position) {
PhotoView photoView = new PhotoView(container.getContext());
photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
imageBrowser.finish();
imageBrowser.overridePendingTransition(0, R.anim.zoom_exit);
}
});
}
网友评论