Comments (2)
The problem is mainly due to the ScrollView behavior. To swipe horizontally a PDFView, which is in a Vertical Scrollview, motion has to be rigorously horizontal, if its a little UP or DOWN the swipe is stopped...
The hack found on internet is to test the motion distance (more vertically than horizontally?):
public class EnableLateralMotionScrollView extends ScrollView {
private GestureDetector mGestureDetector;
public EnableLateralMotionScrollView(Context context, AttributeSet attrs ) {
super(context, attrs);
mGestureDetector = new GestureDetector(context, new YScrollDetector());
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return super.onInterceptTouchEvent(ev) && mGestureDetector.onTouchEvent(ev);
}
// Return false if we're scrolling in the x direction
class YScrollDetector extends GestureDetector.SimpleOnGestureListener {
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
return Math.abs(distanceY) > Math.abs(distanceX);
}
}
}
This is not perfect but it worked.
Do you have a better solution?
from androidpdfviewer.
I find this another workable solution using ScrollView subclass (my case is in minSDKVersion API 16)
public class NoInterceptScrollView extends ScrollView {
public NoInterceptScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return false;
}
}
refer: https://stackoverflow.com/questions/17671123/scrollview-inside-a-scrollview-in-android-issue
from androidpdfviewer.
Related Issues (20)
- .
- PDF page half portion shown blur on many pdfs.
- Unable to go till end of page if autoSpacing set to true
- Cant' compile after adding library Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
- Future of the project HOT 19
- Primer proyecto
- 使用PdfViewer加载本地Pdf文件预览时,pdf文件中的内容会出现拉伸 HOT 2
- ❗Repo not found or no token provided HOT 3
- facing issue in going to specific page in search in pdf in kotline andriod studio
- UnsatisfiedLinkError with PDFium on Android 15 Emulator with 16 KB Page Size
- ViewPager2 中包裹了PDFView控件,当PDFView控件中加载pdf进行垂直方向滑动时,滑动卡顿,请问有解决办法吗,谢谢
- In a ViewPager2, a PDFView control is wrapped. When scrolling vertically within the PDFView while loading a PDF, the scrolling is jerky. Do you have any solutions for this issue? Thank you.
- Need help resolving a Null Pointer Exception,at com.github.barteksc.pdfviewer.PDFView.loadComplete (PDFView.java:756)
- Moving the project to Open Source Organization like Apache Software Foundation HOT 3
- Issue with Tap Location and Page Number Mapping in PDFView
- only android support?
- Why was 3.2.0-beta.1 release removed? HOT 9
- I use this jumpTo method to jump to the specified page and the content automatically goes to the left
- Is the JitPack repository private? HOT 7
- com.github.barteksc:android-pdf-viewer:2.8.2 Not found in mavenCentral HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from androidpdfviewer.