This article shares the specific code for PhotoView to double-click to enlarge and click to exit for your reference. The specific content is as follows
Implementation ideas
1. Copy PhotoView to libs, and then add a small bottle
2. Layout the xml file, add PhotoView control, and load a picture of src, and zoom in and out
Set click events to achieve click exit Activity
Guide jar package
compile files('libs/')
conductlayout
<RelativeLayout xmlns:andro android: android:layout_width="match_parent" android:layout_height="match_parent"> < android:layout_width="wrap_content" android:layout_height="wrap_content" android: android:src="@drawable/ic_emptya"/> </RelativeLayout>
Implementation in MainActivity
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { (savedInstanceState); setContentView(.activity_main); PhotoView pv = (PhotoView) findViewById(); (new () { @Override public void onPhotoTap(View view, float v, float v1) { finish(); } }); } }
Okay, this can achieve the effect of double-clicking the image to enlarge and clicking to exit. It is relatively simple, you can do it!