Open kayesn786 opened 4 years ago
Hi,
I just enabled dark mode in android 10 it doesnt effect my app it looks like it is more for the android interface,
Do you have issues with all your pdfs or just that one ?
What do you have behind the pdfview ?
Hi Not all devices with android 10 has this issue. I have tested in on POCO F1 with android 10, it just works flawlessly. But when i tested it on Redmi K20 pro, i am facing this issue with all the PDF's.
I am displaying the pdf inside fragment.
here is the layout file of the same
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent">
<com.github.barteksc.pdfviewer.PDFView
android:id="@+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Thanks
Might be worth trying the spacing option and or pdfview background colour or activity background, start with the simple options first.
Hi @1stmetro, I have added a white background to the to the pdfview as well as the Activity. But still the issue persists in Redmi K20 pro.
Any other changes i need to do? Thanks
Having the same issue as @kayesn786. Tested on Mi 9 with android 10.
I found a workaround for this
<com.github.barteksc.pdfviewer.PDFView android:id="@+id/pdfView" android:forceDarkAllowed="false" android:layout_width="match_parent" android:layout_height="match_parent"/>
by forcing the pdfview not to allow DarkMode. But it only works for Android 10. I haven't tested with the other android versions.
@kaungkhantsoe , Thanks a lot. It worked.
Have the same issue https://github.com/barteksc/AndroidPdfViewer/issues/954
@deepak786 the workaround specified by @kaungkhantsoe worked for me.
You can add it in a new folder layout-v29
since android:forceDarkAllowed="false" only works v29 and up.
One question though: Do you plan to fix this issue, eventually? while our users are constantly keep asking us why they can't view their PDFs in Darkmode.
FYI : this issue happen on all my Android 10+ devices (Samsung S10+, Google Pixel 3+, OnePlus and Sony) Thanks!
I want the PDF to have white background. But Android 10 is forcing overlapping its dark theme with the white background. Any changes i need to do?
Here is my code
pdfView.useBestQuality(true); Constants.Cache.CACHE_SIZE = 50; pdfView.fromAsset(Constant.privacy) .enableSwipe(true) .swipeHorizontal(false) .enableDoubletap(true) .defaultPage(0). enableAnnotationRendering(false).password(null).spacing(10).onDraw(new OnDrawListener() { @Override public void onLayerDrawn(Canvas canvas, float pageWidth, float pageHeight, int displayedPage) { canvas.setDrawFilter(antialiasFilter); } }).nightMode(false) .pageFitPolicy(FitPolicy.BOTH) .scrollHandle(new DefaultScrollHandle(getContext())) .load();
Any sort of Help is appreciated. Thanks