Subsampling Zoom Image View - 支持大圖的自定義ImageView
自定義的Android ImageView。可捏縮放和二次取樣瓷磚,支持大圖像。
如果你想加載超大圖片(1m以上),同時又想讓圖片可以隨意的縮放,還想要流暢的效果,還不想發生oom,那么這個項目絕對是不二的選擇。其流暢度與可操作性絕對不輸原生相冊應用。demo中的圖片最大是2.7m,但是一點也不卡。
特性
圖片展示
- Display images from assets, resources or the file system
- Automatically rotate images from the file system (e.g. the camera or gallery) according to EXIF
- Manually rotate images in 90° increments
- Swap images at runtime
- Use a custom bitmap decoder </ul>
- Display huge images, larger than can be loaded into memory
- Show high resolution detail on zooming in
- Tested up to 20,000x13,000px, though larger images are slower </ul>
- One finger pan
- Two finger pinch to zoom
- Quick scale (one finger zoom)
- Pan while zooming
- Seamless switch between pan and zoom
- Fling momentum after panning
- Double tap to zoom in and out
- Options to disable pan and/or zoom gestures </ul>
- Public methods for animating the scale and center
- Customisable duration and easing
- Optional uninterruptible animations </ul>
- SupportsOnClickListenerandOnLongClickListener
- Supports interception of events usingGestureDetectorandOnTouchListener
- Extend to add your own gestures </ul>
- Use within aViewPagerto create a photo gallery
- Easily restore scale, center and orientation after screen rotation
- Can be extended to add overlay graphics that move and scale with the image
- Handles view resizing andwrap_contentlayout </ul>
- SubsamplingScaleImageViewrequires SDK 10 (Gingerbread).
- SubsamplingScaleImageViewcannot display aBitmapobject - the image file needs to be in assets, resources or external storage.
- SubsamplingScaleImageViewcannot display grayscale PNGs on Android Lollipop, due to bugs in the skia library and/or BitmapRegionDecoder. Earlier versions of Android also have issues displaying some grayscale PNGs, but not all. I have reported these bugs to Google. For a workaround, see the section on custom bitmap decoders below.
- These views do not extend ImageView so attributes including android:tint, android:scaleType and android:src are not supported.
- Images stored in resources and assets cannot be rotated based on EXIF, you'll need to do it manually. You probably know the orientation of your own files :-) </ul> </div>
SubsamplingScaleImageViewonly:
These views don't extendImageViewand aren't intended as a general purpose replacement for it. They're specialised for the display of photos and other large images, not the display of 9-patches, shapes and the other types of drawable that ImageView supports.
手勢檢測
動畫
重寫事件檢測
易于集成
局限
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!