Skip to content
Proyectos

boycy815/PinchImageView

Ver en GitHub

boycy815/PinchImageView has 1,953 GitHub stars and 488 forks. GitHot measured 0 stars in 24 hours, -1 in 7 days, and -3 in 15 days. Last checked 2026-11-21 08:12 UTC. Last push 2024-08-28.

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
0
in 7 days
-1
in 15 days
-3
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

Acerca de

体验极佳的Android图片手势控件。An Android image gesture control with excellent user experience.

Herramientas de desarrollo

README.md

Original

PinchImageView

English | 简体中文

A gesture-friendly and easy-to-use image pinch-zoom control. It extends ImageView, is contained in a single class file, has no external dependencies, and is lightweight and easy to integrate.

Demo

demo

Demo Description

  1. Integrated with ViewPlayer, preloads thumbnail images when the image is not on the current page, and switches to high-definition images when the page is in view.
  2. Transition animations between thumbnail and full-size image viewing modes.
  3. Loads extremely large images in segments.
  4. Long image browsing mode.

Features

Gestures

  1. Single-finger swipe
  2. Single-finger swipe inertia
  3. Swipe stops at the boundary
  4. Double-tap to zoom in and out
  5. When double-tapping to zoom in, the tap point is centered as much as possible
  6. Pinch-zoom with two fingers to enter zoom mode
  7. In zoom mode, the image can be moved
  8. In zoom mode, the image can be moved beyond the boundaries
  9. In zoom mode, the image can be zoomed in or out beyond the boundary size
  10. Exit zoom mode (all fingers lifted), and the image rebounds to the nearest appropriate position

Display

  1. Compatible with ImageView API
  2. Supports image resolution switching
  3. Rectangular mask overlay

Extensibility

  1. Click and long-press events
  2. Listeners for image size and position changes
  3. Get current size and position
  4. Get current gesture state
  5. API to perform image zoom and move animations
  6. API to perform mask move and zoom animations
  7. Override to set the maximum zoom size for images
  8. Override to set the scale for zooming in or out after double-tap

Quick Start

1) Copy PinchImageView.java into your project.

2) Add the following code to your layout file; it can already display an image from resources:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.boycy815.pinchimageview.PinchImageView
        android:id="@+id/pic"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/my_pic"/>
</RelativeLayout>

3) Use it directly as an ImageView:

// Retrieve it as an ImageView
ImageView imageView = (ImageView) findViewById(R.id.pic);
// You can set the image using any method supported by ImageView
imageView.setImageResource(R.drawable.my_pic);
// or...
imageView.setImageBitmap(bitmap);
// or...
imageView.setImageDrawable(drawable);
// or you can even use third-party image loading libraries, like ImageLoader
imageLoader.displayImage("http://host.com/my_pic.jpg", imageView);