Giter Site home page Giter Site logo

fanmixco / zoomimage-xamarin Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 0.0 6.18 MB

A simple pinch-to-zoom ImageView binding library for Xamarin.Android, based on Jeff Sibbold's version.

Home Page: https://fanmixco.github.io/ZoomImage-Xamarin/

License: Apache License 2.0

C# 100.00%
pinch-to-zoom imageview xamarin xamarin-android android xamarin-android-binding xamarin-library zoom zoomable translatable

zoomimage-xamarin's Introduction

ZoomImage-Xamarin

A simple pinch-to-zoom ImageView binding library for Xamarin.Android with an emphasis on a smooth and natural feel, based on: https://github.com/jsibbold/zoomage

Package Latest Release
ZoomImage-Xamarin NuGet Badge ZoomImage-Xamarin

Using It

Simply add a ZoomageView as you would any typical ImageView in Android. The scaleType that you set on your ZoomageView will determine the starting size and position of your ZoomageView's image. This is the inherited ImageView.ScaleType from Android. With a ZoomageView, the fitCenter or centerInside scale types usually make the most sense to use, fitCenter being Android's default scale type.

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <com.jsibbold.zoomage.ZoomageView
            android:id="@+id/myZoomageView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@drawable/my_zoomable_image"
            app:zoomage_restrictBounds="false"
            app:zoomage_animateOnReset="true"
            app:zoomage_autoResetMode="UNDER"
            app:zoomage_autoCenter="true"
            app:zoomage_zoomable="true"
            app:zoomage_translatable="true"
            app:zoomage_minScale="0.6"
            app:zoomage_maxScale="8"
            />
    </RelativeLayout>

If using a ZoomageView with a view pager, it is recommended that ViewPager2 is used.

XML Attributes

zoomage_restrictBounds="true|false"

Restricts the bounds of the image so it does not wander outside the border of the ImageView when it's smaller than the frame size, and restricts the bounds to stop at the edges of the ImageView when the image is larger than the frame size. Default value is false.

zoomage_animateOnReset="true|false"

Image will animate back to its starting size whenever it is reset if true, and will snap back to its starting size when false. Default value is true.

zoomage_autoResetMode="UNDER|OVER|ALWAYS|NEVER"

Determines at what times the image will reset to its starting size. Note that UNDER, OVER, and ALWAYS all have the effect of resetting the image to its starting position if its size has not changed. Default value is UNDER.

zoomage_autoCenter="true|false"

This will cause the image to pull itself into view on-screen if it is partially off-screen. Default value is true.

zoomage_minScale="{float greater than 0}"

The minimum allowed scale for the image. Ideally this should be less than 1, must be greater than 0, and must be less than maxScale. Default value is 0.6.

zoomage_maxScale="{float greater than 0}"

The maximum allowed scale for the image. Ideally this should be greater than 1, must be greater than 0, and must be greater than minScale. Default value is 8.

zoomage_zoomable="true|false"

Sets whether zooming is allowed. Default value is true.

zoomage_translatable="true|false"

Sets whether translation is allowed. Default value is true.

zoomage_doubleTapToZoom="true|false"

Sets whether double tap to zoom functionality is enabled. Default is true.

zoomage_doubleTapToZoomScaleFactor="{float within bounds of min and max scale}"

Sets the scale factor for double tap to zoom functionality. Default is 3.


Special thanks to @mchowning for all his help

License

Copyright 2016 Jeffrey Sibbold

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Follow me at:

LinkedIn YouTube Amazon Goodreads Instagram Cyber Prophets Sharing Your Stories
LinkedIn YouTube Amazon Goodreads Instagram RedCircle Podcast RedCircle Podcast

zoomimage-xamarin's People

Contributors

fanmixco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.