PhotoView
PhotoView copied to clipboard
PhotoViewAttacher.getScaleType()' on a null object reference
my app use ViewPager2 + PhotoView + Glide, to see a few picture, the app crash. version 1.3.1
java.lang.NullPointerException: Attempt to invoke virtual method 'android.widget.ImageView$ScaleType uk.co.senab.photoview.PhotoViewAttacher.getScaleType()' on a null object reference at uk.co.senab.photoview.PhotoView.getScaleType(PhotoView.java:115) at com.bumptech.glide.RequestBuilder.into(RequestBuilder.java:680)
And the touch event for ViewPager2 still works during scaling.
Issues:The touch event for ViewPager2 still works during scaling.
You can call parent.requestDisallowInterceptTouchEvent(true)
method when MotionEvent.getPointerCount() > 1.
@kelinZhou where exactly do you make this check?
<---?xml version="1.0" encoding="utf-8"?-->
<---LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:gravity="center">
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/pvPhotoView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<--/LinearLayout-->
try this...
I'm using this approach with waiting for an image view display by the GlobalLayout listener to solve this issue.
Thanks!!