DImuthuUpe / AndroidPdfViewer

Android view for displaying PDFs rendered with PdfiumAndroid
Apache License 2.0
8.18k stars 1.91k forks source link

PDFView Height #396

Open WangManAndroid opened 7 years ago

WangManAndroid commented 7 years ago

how could i change the PDFView height?like the ScrollView ,but now the PDFView height is settled

barteksc commented 7 years ago

You can configure PDFView like any other Android view

WangManAndroid commented 7 years ago

but if the PDFView is the child of ScrollView it will show nothing, how could i solved it ,I am in a hurry

alexluckyq commented 6 years ago

maybe it is too late. but using getViewTreeObserver().addOnGlobalLayoutListener on pdf view can solve the problem. following is a code snipe. hop it can help:

pdfView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { pdfView.getViewTreeObserver().removeOnGlobalLayoutListener(this); ViewGroup.LayoutParams params = pdfView.getLayoutParams(); params.width = ViewUtil.getWindowWidth(getContext()); params.height = [Height you want]; pdfView.setLayoutParams(params); } } });