Image-Zoomer

Additional

Language
Java
Version
N/A
Created
Jun 15, 2016
Updated
Oct 24, 2018
Owner
Vatsal Bajpai (code-crusher)
Contributor
Vatsal Bajpai (code-crusher)
1
Activity
Badge
Generate
Download
Source code
APK file

Advertisement

Image-Zoomer


Usage

Method 1 : XML

In your activity_main.xml file use this code instead of ImageButton:

<com.vatsal.imagezoomer.ImageZoomButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@mipmap/ic_launcher" />

Attributes

    • To set the duration use:
    • To use the reverse mode:

Method 2 : Java

In your MainActivity.class use this code in OnClick() of ImageButton:

Activity activity = getActivity();
ImageButton imageButton = (ImageButton) findViewById(R.id.image_button);
long duration = 500;
  • For simple zoom:
imageButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ZoomAnimation zoomAnimation = new ZoomAnimation(activity);
                zoomAnimation.zoom(v, duration);
            }
        });
  • For Reverse zoom:
imageButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ZoomAnimation zoomAnimation = new ZoomAnimation(activity);
                zoomAnimation.zoomReverse(v, duration);
            }
        });
Variable Type
image_button ImageButton
activity Activity
duration(ms) long

License

Copyright 2016 Vatsal Bajpai

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.