Image-Zoomer
Specs
Image zoomer provides easy way to add zoom animations to you ImageButton. You can set the animation duration and reverse mode to reverse the animation.
Featured in
Screenshots
Zoom Reverse
Integration
- ImageZoomer is available in the MavenCentral, so getting it as simple as adding it as a dependency
compile 'com.vatsal.imagezoomer:image-zoomer:1.0.2'
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
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.