<uses-permission android:name="android.permission.INTERNET"></uses-permission>compile 'com.github.chrisbanes:PhotoView:2.1.3'maven { url "https://jitpack.io" }
<com.github.chrisbanes.photoview.PhotoView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/pv"/>package com.exbawei.liteli.keshang; import android.support.v4.view.GestureDetectorCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.GestureDetector; import android.view.MotionEvent; import com.bumptech.glide.Glide; import com.bumptech.glide.GlideBuilder; import com.bumptech.glide.load.model.GenericLoaderFactory; import com.github.chrisbanes.photoview.PhotoView; public class MainActivity extends AppCompatActivity { GestureDetector.OnGestureListener listener; GestureDetectorCompat compat; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PhotoView pv= (PhotoView) findViewById(R.id.pv); Glide .with(MainActivity.this) .load("https://img-my.csdn.net/uploads/201404/13/1397393290_5765.jpeg") .into(pv); // Picasso listener = new GestureDetector.OnGestureListener() { @Override public boolean onDown(MotionEvent motionEvent) { return false; } @Override public void onShowPress(MotionEvent motionEvent) { } @Override public boolean onSingleTapUp(MotionEvent motionEvent) { return false; } @Override public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent1, float v, float v1) { return false; } @Override public void onLongPress(MotionEvent motionEvent) { } @Override public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent1, float v, float v1) { return false; } }; compat = new GestureDetectorCompat(MainActivity.this,listener); } @Override public boolean onTouchEvent(MotionEvent event) { return super.onTouchEvent(event); } }
photoview
最新推荐文章于 2024-08-08 08:13:27 发布