0

我正在使用一个 Github 库来查看 PDF 文件。 https://github.com/barteksc/AndroidPdfViewer

我想设置滚动方向 RTL。请帮助更改此库的滚动方向。

我已经尝试了以下链接 https://github.com/JoanZapata/android-pdfview/issues/60的解决方案

但它对我不起作用。

4

3 回答 3

2

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

于 2019-01-17T07:13:43.873 回答
0

尝试添加清单文件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);
于 2017-04-03T12:44:38.417 回答
0

在 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;
}

为我工作:)

于 2021-10-16T15:25:08.890 回答