Project GitHub Address: Https://github.com/bm-x/PhotoView
Personal projects GitHub Address: Https://github.com/anan03/ananwork/tree/master/PhotoView
PhotoView Picture View Zoom Control
Use the same way as normal ImageView.
If there are any bugs, comments or suggestions in the course of use, please email me [email protected]
Attention
Since the drawable images loaded by Facebook's fresco picture loading component are not real drawable, they cannot directly capture the true width of the image or directly respond to Imagematrix transformations, and according to the fresco documentation, in subsequent versions , Draweeview will inherit from view directly, and all support fresco is not considered. For other third-party picture loading libraries such as glide,imageloader,xutils are supported
Use
1.Gradle add dependency (recommended)
dependencies { ' com.bm.photoview:library:1.4.1'}
(or you can download the project and copy the Info.java and Photoview.java two files to your project, not recommended)
2.xml add
<Com.bm.library.PhotoViewandroid:id="@+id/img" android:layout_width="Match_parent" Android :layout_height="Match_parent" android:scaletype="Centerinside" android:src="@drawable/bitmap1"/>
3.java Code
PhotoView PhotoView= (PhotoView) Findviewbyid (R. ID. img);Enable the picture zoom feature Photoview. Enable ();Disable picture zoom (disabled by default, as with normal imageview, the zoom function needs to be manually called Enable () enabled) PhotoView. Disenable ();Get picture informationInfo Info= PhotoView. GetInfo ();Get info from a regular imageviewInfo Info=PhotoView. Getimageviewinfo (ImageView);From a picture information changes to the current picture, for the image click to enlarge browsing, specific use can refer to the use of the demo Photoview. Animafrom (info);From the current picture changes to the given picture information, for the image to zoom in and click to reduce to the original position, the use can refer to the use of the demo Photoview. Animato (Info,new Runnable () { @Override public void Run () { ///Animation completion listener}); Gets/sets the duration of the animation Photoview. setanimaduring (int during); int D = PhotoView. getanimaduring (); Gets/sets the maximum zoom multiplier Photoview. Setmaxscale (float maxscale); float Maxscale = PhotoView. Getmaxscale (); Sets the animation of the Photoview. Setinterpolator (interpolator interpolator); Version
v1.4.0
- Increased support for ordinary ImageView can be obtained by Photoview static method Getimageviewinfo (ImageView) from a common ImageView, referring to imageviewactivity
- Add monitoring for long press events, Setonlongclicklistener ()
- Improves the smoothness of the slide when the picture zooms to the edge of the screen
- New get/setanimaduring () Get/setmaxscale Gets the duration of the set animation and the maximum zoom multiplier of the picture
- Animating the insertion device via Setinterpolator
v1.3.6
- Increase the rotation function of the picture
- Change the name of the version number
v2.0.7
- The width Height property can be set to wrap_content, adding support for the Adjustviewbounds property
- Fixed some cases flashing
- Increased support for Scaletype.fit_start,fit_end to Animafrom
v2.0.0
- Add Animato,animafrom method, support image Click to zoom out browsing function
- Add enable () and disenable () to turn on and off the touch zoom method, which is turned on by default (it is recommended to turn off the touch zoom function when normal imageview is used)
- Supports all ScaleType properties
v1.0
Android Big picture Preview Viewpager