Top Related Projects
图片浏览缩放控件
Android library (AAR). Highly configurable, easily extendable deep zoom view for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.
Customizable Android full screen image viewer for Fresco library supporting "pinch to zoom" and "swipe to dismiss" gestures. Made by Stfalcon
Big image viewer supporting pan and zoom, with very little memory usage and full featured image loading choices. Powered by Subsampling Scale Image View, Fresco, Glide, and Picasso. Even with gif and webp support! 🍻
Quick Overview
PhotoDraweeView is an Android library that extends Fresco's DraweeView to support zooming and panning functionality for images. It provides a seamless integration with Fresco's image loading and caching capabilities while adding interactive features commonly needed for photo viewing applications.
Pros
- Seamless integration with Fresco library for efficient image loading and caching
- Supports zooming and panning gestures for interactive image viewing
- Easy to implement and customize for various photo viewing scenarios
- Maintains good performance even with large images
Cons
- Requires Fresco as a dependency, which may increase app size
- Limited documentation and examples available
- Not actively maintained (last update was in 2018)
- May require additional work to integrate with newer Android architecture components
Code Examples
- Basic implementation of PhotoDraweeView:
val photoDraweeView: PhotoDraweeView = findViewById(R.id.photo_drawee_view)
val uri = Uri.parse("https://example.com/image.jpg")
photoDraweeView.setPhotoUri(uri)
- Setting maximum and minimum scale:
photoDraweeView.maximumScale = 5f
photoDraweeView.minimumScale = 0.5f
- Adding a tap listener:
photoDraweeView.setOnPhotoTapListener { view, x, y ->
Toast.makeText(this, "Photo tapped at ($x, $y)", Toast.LENGTH_SHORT).show()
}
- Programmatically zooming to a specific point:
photoDraweeView.setScale(2f, 100f, 100f, true)
Getting Started
To use PhotoDraweeView in your Android project:
- Add the JitPack repository to your project's build.gradle file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Add the dependency to your app's build.gradle file:
dependencies {
implementation 'com.github.ongakuer:PhotoDraweeView:1.1.3'
implementation 'com.facebook.fresco:fresco:2.6.0'
}
- Initialize Fresco in your Application class:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Fresco.initialize(this)
}
}
- Use PhotoDraweeView in your layout XML:
<me.relex.photodraweeview.PhotoDraweeView
android:id="@+id/photo_drawee_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Competitor Comparisons
图片浏览缩放控件
Pros of PhotoView
- More comprehensive feature set, including support for various image types and gestures
- Active development with frequent updates and bug fixes
- Larger community and more extensive documentation
Cons of PhotoView
- Heavier library size compared to PhotoDraweeView
- May have a steeper learning curve due to more complex API
Code Comparison
PhotoView:
PhotoView photoView = findViewById(R.id.photo_view);
photoView.setImageResource(R.drawable.image);
photoView.setScaleType(ImageView.ScaleType.CENTER_CROP);
PhotoDraweeView:
SimpleDraweeView draweeView = findViewById(R.id.photo_drawee_view);
draweeView.setImageURI("https://example.com/image.jpg");
draweeView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP);
Both libraries provide similar functionality for displaying and manipulating images, but PhotoView offers more advanced features and customization options. PhotoDraweeView, on the other hand, is more lightweight and integrates well with Fresco image loading library.
PhotoView is better suited for projects requiring extensive image manipulation and zooming capabilities, while PhotoDraweeView is ideal for simpler use cases or when working with Fresco. The choice between the two depends on the specific requirements of your project and the desired balance between features and performance.
Android library (AAR). Highly configurable, easily extendable deep zoom view for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.
Pros of subsampling-scale-image-view
- Supports very large images (up to 20,000x20,000 pixels) with efficient memory usage
- Offers smooth scrolling and zooming with minimal lag
- Provides more customization options for image display and interaction
Cons of subsampling-scale-image-view
- Lacks built-in integration with Fresco image loading library
- May require more setup and configuration compared to PhotoDraweeView
- Does not automatically handle image caching and memory management
Code Comparison
subsampling-scale-image-view:
SubsamplingScaleImageView imageView = new SubsamplingScaleImageView(context);
imageView.setImage(ImageSource.uri("/sdcard/image.jpg"));
imageView.setMaxScale(10f);
PhotoDraweeView:
SimpleDraweeView draweeView = (SimpleDraweeView) findViewById(R.id.my_image_view);
draweeView.setPhotoUri(Uri.parse("https://example.com/image.jpg"));
Both libraries offer easy-to-use APIs for displaying and manipulating images. subsampling-scale-image-view provides more control over image scaling and display, while PhotoDraweeView integrates seamlessly with Fresco for efficient image loading and caching. The choice between the two depends on specific project requirements, such as image size, memory constraints, and desired customization options.
Customizable Android full screen image viewer for Fresco library supporting "pinch to zoom" and "swipe to dismiss" gestures. Made by Stfalcon
Pros of FrescoImageViewer
- Provides a full-screen image viewer with zooming and panning capabilities
- Supports multiple images with swipe gestures for navigation
- Offers customizable overlay views and transitions
Cons of FrescoImageViewer
- Limited to Fresco library, not compatible with other image loading libraries
- May have a steeper learning curve due to more complex implementation
- Less frequently updated compared to PhotoDraweeView
Code Comparison
PhotoDraweeView:
PhotoDraweeView mPhotoDraweeView = findViewById(R.id.photo_drawee_view);
mPhotoDraweeView.setPhotoUri(Uri.parse("https://example.com/image.jpg"));
FrescoImageViewer:
new ImageViewer.Builder<>(this, imageUrls)
.setStartPosition(startPosition)
.setOverlayView(customView)
.show();
PhotoDraweeView focuses on providing a simple, zoomable view for a single image, while FrescoImageViewer offers a more comprehensive solution for viewing multiple images with additional features. PhotoDraweeView is easier to implement for basic use cases, whereas FrescoImageViewer provides more customization options but requires more setup. Both libraries leverage Fresco's efficient image loading capabilities, but FrescoImageViewer is more tightly coupled with the Fresco ecosystem.
Big image viewer supporting pan and zoom, with very little memory usage and full featured image loading choices. Powered by Subsampling Scale Image View, Fresco, Glide, and Picasso. Even with gif and webp support! 🍻
Pros of BigImageViewer
- Supports multiple image loading libraries (Fresco, Glide, and custom image loaders)
- Offers more advanced features like progressive loading and thumbnail support
- Provides a more comprehensive solution for handling large images
Cons of BigImageViewer
- More complex setup and configuration compared to PhotoDraweeView
- Larger library size due to additional features and dependencies
- May have a steeper learning curve for developers new to the library
Code Comparison
PhotoDraweeView:
PhotoDraweeView photoDraweeView = findViewById(R.id.photo_drawee_view);
photoDraweeView.setPhotoUri(Uri.parse("https://example.com/image.jpg"));
BigImageViewer:
BigImageView bigImageView = findViewById(R.id.big_image_view);
bigImageView.showImage(Uri.parse("https://example.com/image.jpg"));
Both libraries provide simple ways to display images, but BigImageViewer offers more flexibility in terms of image loading and advanced features. PhotoDraweeView is more straightforward and lightweight, focusing primarily on zooming and panning functionality for Fresco's DraweeView. BigImageViewer, on the other hand, provides a more comprehensive solution for handling large images with support for multiple image loading libraries and advanced features like progressive loading.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
PhotoDraweeView
Gradle
AndroidX
dependencies {
implementation 'com.facebook.fresco:fresco:x.x.x' // (latest)
implementation 'me.relex:photodraweeview:2.1.0'
}
Android Support Library
dependencies {
implementation 'com.facebook.fresco:fresco:x.x.x' // (latest)
implementation 'me.relex:photodraweeview:1.1.3'
}
Usage
mPhotoDraweeView.setPhotoUri(Uri.parse("http://your.image.url"));
Using the ControllerBuilder
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
controller.setUri(URI);
controller.setOldController(mPhotoDraweeView.getController());
controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
super.onFinalImageSet(id, imageInfo, animatable);
if (imageInfo == null || mPhotoDraweeView == null) {
return;
}
mPhotoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
}
});
mPhotoDraweeView.setController(controller.build());
Issues With ViewGroups
Top Related Projects
图片浏览缩放控件
Android library (AAR). Highly configurable, easily extendable deep zoom view for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.
Customizable Android full screen image viewer for Fresco library supporting "pinch to zoom" and "swipe to dismiss" gestures. Made by Stfalcon
Big image viewer supporting pan and zoom, with very little memory usage and full featured image loading choices. Powered by Subsampling Scale Image View, Fresco, Glide, and Picasso. Even with gif and webp support! 🍻
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot