PDF用于应用程序?

时间:2014-04-25 05:20:46

标签: android pdf android-studio drawable

我有一个PDF,我希望在我正在创建的应用程序中。我知道我可以将pdf转换为drawable并将其设置为活动的背景。唯一的问题是PDF有多个页面,我不知道如何滚动它们。我想知道是否有办法滚动绘图或最好的方法来设置它。

我正在为学校创建一个应用程序,我想要的PDF是学生手册。目前我有应用程序在浏览器中打开PDF然后下载它但我希望它在应用程序中打开?

以下是我按下按钮时会发生什么的当前代码

public void startNewActivityHandbook (View view) {
    goToUrl ( "http://www.northglennhs.org/images/stories/NGHS_forms/2013-2014%20schedule.pdf");
}

1 个答案:

答案 0 :(得分:0)

如果要将pdf设置为可作为活动背景的drawable,请使用scrollview环绕布局,以便在滚动不同页面时滚动pdf drawable。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
<RelativeLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/pdf_drawable">
</RelativeLayout>
</ScrollView>  
相关问题