Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination in ANDROID #18

Open
ritika-mittal opened this issue May 1, 2012 · 4 comments
Open

Pagination in ANDROID #18

ritika-mittal opened this issue May 1, 2012 · 4 comments

Comments

@ritika-mittal
Copy link

Hi,

I have shown the spines in pages but what if the spine has a long data? How can i show them in pages?? I know there has been the same issue logged but i didnt get any help :( .

Thanks,
Ritika Mittal

@NightWhistler
Copy link
Contributor

The short answer is: by processing the text and cutting it into page-sized chunks.

Longer answer: this means you cannot directly display the text in a webview, but you have to process it first.

@ritika-mittal
Copy link
Author

By processing the text do you mean that i need to parse the whole xhtml spine and setting spans for each tag??

@NightWhistler
Copy link
Contributor

From your comments on another issue I understand you're using HtmlSpanner now.

This means you should already have a Spanned text, so now all you have to do is to take the right sub-string to leave you with exactly one page of text. My solution was to use a StaticLayout to measure how much text fits on the screen, and then put that sub-string in the TextView.

Take a look at this code to see what I mean, but be careful: it's GPL licenced:
https://github.com/NightWhistler/PageTurner/blob/master/src/main/java/net/nightwhistler/pageturner/view/SinglePageStrategy.java

@RioTech
Copy link

RioTech commented Jan 4, 2013

Hi,

I am also using staticLayout. But, My layout.getLineStart(topLine); and layout.getLineEnd(bottomLine) not working properly. It's giving topLine number+1 and bottomLine number +1 value :( I Have tried/searched lot but no luck. Could you please help me on this regard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants