2017-09-21 35 views
0

com.github.barteksc.pdfviewer.PDFViewのPDFViewを試してみます。PDFViewでスクロール垂直を設定する方法(com.github.barteksc.pdfviewer.PDFView)

私はいくつかのボタンを持つScrollViewを持っており、それらのボタンの真ん中にはPDFViewがあります。

PDFViewは5ページのPDFファイルです。

問題は、アプリケーションを実行してPDFViewにスクロールするときです。私はPDFファイルの最初のページしか見ることができません。

PDFViewまでスクロールしてPDFView内をスクロールするにはどうすればよいですか?

ありがとうございました。

画像: https://drive.google.com/open?id=0B2QkD8wCK_jqX2d0YlFVT2J3X2M

コード:

package gmm.formulariogmm; 

import android.os.Bundle; 
import android.support.v7.app.AppCompatActivity; 
import android.widget.Toast; 

import com.github.barteksc.pdfviewer.PDFView; 


public class PDFViewDemo extends AppCompatActivity { 

PDFView pdfView; 

@Override 
public void onCreate(Bundle savedInstanceState) { 


     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_pdfview); 

     pdfView = (PDFView) findViewById(R.id.pdfView); 
     pdfView.fromAsset("test.pdf").load(); 

} 
};//Fin 

レイアウト:

<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <Button 
      android:id="@+id/button1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Button1" /> 

     <Button 
      android:id="@+id/button2" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Button2" /> 

     <Button 
      android:id="@+id/button3" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Button3" /> 

     <Button 
      android:id="@+id/button4" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Button4" /> 

     <com.github.barteksc.pdfviewer.PDFView 
      android:id="@+id/pdfView" 
      android:layout_width="match_parent" 
      android:layout_height="300dp" /> 

     <Button 
      android:id="@+id/button5" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Button5" /> 

     <Button 
      android:id="@+id/button6" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Button6" /> 
    </LinearLayout> 

</ScrollView> 

答えて

-1
pdfView.fromAsset(SAMPLE_FILE) 
      .defaultPage(pageNumber) 
      .enableSwipe(true) 
      .enableDoubletap(true) 
      .swipeVertical(false) 
      .showMinimap(false) 
      .onRender(new OnRenderListener() { 
      @Override 
      public void onInitiallyRendered(int pages, float pageWidth, 
      float pageHeight) { 
      pdfview.fitToWidth(); // optionally pass page number 
       } 
      }); 
      .onLoad(this) 
      .scrollHandle(new DefaultScrollHandle(this)) 
      .load(); 
関連する問題