There are often picture-browsing features in the project. Like a friend circle picture browsing, QQ space photo browsing features.
Realize the picture double-click Enlarge, shrink, left and right slide effect.
Come and see me, I hope I can meet your demands.
The top three button buttons are various implementations of the reference network, three custom picture controls,
The 4th one is Viewpager realize the picture left and right slide
Public classViewpagerimageviewzquiextendsappcompatactivity {Viewpager viewpager; Private int[] Mimgs =New int[] {r.mipmap.img1, r.mipmap.img2, r.mipmap.tour}; Imageview[] Mimageviews; @Overrideprotected voidonCreate (@Nullable Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (r.layout.viewpager_layout); Initview (); } Private voidInitview () {mimageviews=NewImageview[mimgs.length]; Viewpager=(Viewpager) Findviewbyid (R.id.img_viewpager); Viewpager.setadapter (NewPageradapter () {@Override PublicObject Instantiateitem (ViewGroup container,intposition) { //You can use other ImageView controls, other custom controls, you can also use your own OhTounchimageview tounchimageview=NewTounchimageview (Viewpagerimageviewzqui. This); Try{picasso.with (viewpagerimageviewzqui). This). Load (Mimgs[position]). Placeholder (R.MIPMAP.IMG1)//the picture that is displayed by default//. Resize (500,300)//control the height of the picture, not add it adaptive. Error (R.mipmap.ic_launcher)//a picture appears incorrectly when loading. into (Tounchimageview); } Catch(Exception e) {}//Click BackTounchimageview.setonclicklistener (NewView.onclicklistener () {@Override Public voidOnClick (View v) {finish (); } }); Container.addview (Tounchimageview, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_ CONTENT); Mimageviews[position]=Tounchimageview; returnTounchimageview; } @Override Public intGetCount () {returnmimgs.length; } @Override Public voidDestroyitem (ViewGroup container,intposition, Object object) {Container.removeview (mimageviews[position]); } @Override Public BooleanIsviewfromobject (View arg0, Object arg1) {returnarg0 = =arg1; } }); }}
The 5th button mainly refers to the PhotoView of the use of a variety of ways, leaflets, rotation, viewpager,gridview, etc.
Because the interface is too many, not upload too many pictures, download run See effect can.
Code Portal
Android------Achieve a picture double click to zoom in, zoom out, swipe left and right in various ways