我正在使用一个 Github 库来查看 PDF 文件。 https://github.com/barteksc/AndroidPdfViewer
我想设置滚动方向 RTL。请帮助更改此库的滚动方向。
我已经尝试了以下链接 https://github.com/JoanZapata/android-pdfview/issues/60的解决方案
但它对我不起作用。
我正在使用一个 Github 库来查看 PDF 文件。 https://github.com/barteksc/AndroidPdfViewer
我想设置滚动方向 RTL。请帮助更改此库的滚动方向。
我已经尝试了以下链接 https://github.com/JoanZapata/android-pdfview/issues/60的解决方案
但它对我不起作用。
I have found a hack. Rotate your pdf by 180 degress and then add following line in your code
pdf_activity_read_quraan.rotation = 180F
where is pdf_activity_read_quraan
is reference of com.github.barteksc.pdfviewer.PDFView
尝试添加清单文件android:supportsRtl="true"
的Application
标签。
来源:https ://developer.android.com/guide/topics/manifest/application-element.html
可能的解决方法是像这样获取滚动和强制移动:
mScrollView.postDelayed(new Runnable() {
public void run() {
scrollView.fullScroll(HorizontalScrollView.FOCUS_RIGHT); // or scrollTo
}
}, 100L);
在 onCreate 方法中使用 onLoad 方法,如下所示:
mypdfviewer.fromAsset("Quran.pdf").onLoad(new OnLoadCompleteListener() {
@Override
public void loadComplete(int nbPages) {
mypdfviewer.fromAsset("Quran.pdf")
.pages(getPage(nbPages))
.defaultPage(nbPages)
.enableSwipe(true)
.enableDoubletap(true)
.swipeHorizontal(true)
.password(null).enableAntialiasing ( true ).spacing(0)
.pageSnap(true).pageFling(true)
.autoSpacing ( false ).pageFitPolicy ( FitPolicy. WIDTH ).fitEachPage ( true )
.scrollHandle(new DefaultScrollHandle(null))
.load();
}
}).load();
**创建getPage方法**
private int [] getPage(int nbPages) {
int [] pages =new int[nbPages];
int j=0;
for(int i=pages.length-1; i>=0; i--)
{
pages[j]=i;
j++;
}
return pages;
}
为我工作:)