Hello, I am a beginner on developing android app.
And now I am trying to add a button on the pdfview, since I have been successful to merge pdfview into scrollview after getting help from #396
And how should I get the height of the pdfview since I always get 0 when using PDFView.height??
val PDFView = binding.pdfView
PDFView.fromAsset("secrets.pdf").onTap(OnTapListen()).enableSwipe(true)
.swipeHorizontal(false).pageFitPolicy(FitPolicy.BOTH).load()
//Wrong Height
val height = PDFView.height
PDFView.getViewTreeObserver()
.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
@Override
override fun onGlobalLayout() {
PDFView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
val params: ViewGroup.LayoutParams = PDFView.getLayoutParams();
params.width = Resources.getSystem().displayMetrics.widthPixels;
//should not be fixed height
params.height = 10000;
PDFView.setLayoutParams(params);
}
});
Hello, I am a beginner on developing android app. And now I am trying to add a button on the pdfview, since I have been successful to merge pdfview into scrollview after getting help from #396 And how should I get the height of the pdfview since I always get 0 when using PDFView.height??