Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It might be too late for answer, but I'll post how I solved problem like this.</p> <p>I made similar project, but for android tablet. In my application, I have system bottom bar, my navigation bar and header. These parts of Activity don't take part in text preview, so I want to exclude them in calculations. For screen 750px these parts takes 24% of screen, it's about 180px. So I use the following algorithm to view text in text view:</p> <ol> <li>Calculate <em>actual height</em> to view text, it's height of my textview: ScreenHeight - ScreenHeight*0.24</li> <li>Set text size, for example 14.0</li> <li>Calculate number of lines in text file</li> <li>Calculate number of lines per page: Actual height/ text size</li> <li>Calculate number of pages and load them in HashMap</li> </ol> <hr> <pre><code>Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight() — 0.24*display.getHeight(); mLinesInPage = (int) (Math.floor(height / mTextSize)); mPages = (int) (Math.ceil(mLinesInText / mLinesInPage)); </code></pre> <hr> <p>Formatting and other transformations executes "on the fly". Nothing difficult, but works for me. There are examples</p> <p><em>Before using algorithm:</em></p> <p><img src="https://i.stack.imgur.com/agOC1.png" alt="enter image description here"></p> <p><em>After using algorithm:</em></p> <p><img src="https://i.stack.imgur.com/tHd1R.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/nd2Np.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload