android pdf 阅读器开发, pdf demo, pdf第三方控件
来源:互联网 发布:手机车辆管理查询软件 编辑:程序博客网 时间:2024/05/12 11:30
demo library 下载
Activity调用的方法
public class PDFActivity extends Activity implements OnPageChangeListener {public static final String PDF_NAME = "xxx.pdf";// 书名private PDFView pdfView;private TextView pdf_tv_num;private int bookPage = 1;public final static String BOOKID = "bookId";@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_pdf);pdfView = (PDFView) findViewById(R.id.pdfView);pdf_tv_num = (TextView) findViewById(R.id.pdf_tv_num);String bId = mCache.getAsString("pdfPage");// 获取上次读取的页数if (!isNEB(bId)) {bookPage = Integer.parseInt(bId);}String path = activity.getFilesDir().getAbsolutePath();// 获取路径File file = new File(path, PDF_NAME);if (file.exists()) {pdfView.fromFile(file).defaultPage(bookPage).onPageChange(this).load();// 显示要看的第几页}}public void onPageChanged(int page, int pageCount) {bookPage = page;pdf_tv_num.setText(page + "/" + pageCount);// page正在看的页数,pageCount总页数}@Overrideprotected void onStop() {super.onStop();// TODO 这里先保存的页数 bookPage// 如果退出要删除pdf,执底下的代码,否则不需要String path = activity.getFilesDir().getAbsolutePath();File file = new File(path, PDF_NAME);if (file.exists()) {file.delete();finish();}}}布局
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <com.joanzapata.pdfview.PDFView android:id="@+id/pdfView" android:layout_width="match_parent" android:layout_height="match_parent"/> <TextView android:id="@+id/pdf_tv_num" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="10dp" android:textColor="#000000" android:textSize="12sp" /></RelativeLayout>demo library 下载
0 0
- android pdf 阅读器开发, pdf demo, pdf第三方控件
- pdf阅读器开发
- 开源 Android pdf 阅读器开发总结
- 开源 Android pdf 阅读器开发总结
- 开源 Android pdf 阅读器开发总结
- 开源 Android pdf 阅读器开发总结
- 开源 Android pdf 阅读器开发总结
- 开源 Android pdf 阅读器开发总结
- 开源 Android pdf 阅读器开发总结
- 开源 Android pdf 阅读器开发总结
- 开源 Android pdf 阅读器开发总结
- 开源 Android pdf 阅读器开发总结
- pdf阅读器
- java如何开发pdf阅读器
- QT开发的pdf阅读器资料
- [Swift]iOS开发:简易版PDF阅读器
- 快速的PDF阅读器
- pdf阅读器,pdf阅读器大全,最好pdf阅读器排行,pdf阅读器下载
- iOS开发网络篇—数据缓存
- NSPredicate谓词
- 网络数据解析(1) XML
- 网络数据解析(2) JSON
- 网络请求(NSURLConnection)
- android pdf 阅读器开发, pdf demo, pdf第三方控件
- 网络请求(NSURLSession)
- 多线程
- 网络安全
- 调用系统相册
- 搜索栏 UISearchController
- Swift (一)
- 类目中添加属性
- 机器学习实战之回归