4

I want to write an viewer that can display text justified, and it should display the amount of text that it can show on one screen without scrolling. Let say if I use WebView for justifying text, how to calculate the size of the text to be set in the view, so that the view can display it properly with that font without scrolling. I hope you got my question, like ebook readers display text and then you have to swipe to load the next page, I want a similar functionality.

Sam
  • 84,460
  • 18
  • 172
  • 171
Priyank Bolia
  • 12,942
  • 13
  • 57
  • 81

1 Answers1

1

I dont think you can access the text in your HTML so you could try changing the font size with a javascript call.

  1. Calculate the font size in your Activity (or whereever you are calling your webview) either basing on your views size or the screen size or density.
  2. Send it to your webview via a JS call, like this
  3. The change the size in your HTML/JS.
Community
  • 1
  • 1
taymless
  • 771
  • 2
  • 9
  • 24