android - How to divide large string data in multiple pages or activity or fragments or flips -
i trying task after wasting time still didn't solution.
problem: working on news application, flip effect. application shows news content on first page, when user swipes bottom top on screen new flip opens , remaining news text content shown on next flips.
the problem is, set initial text news on first screen on text view, when user swipe more news, unable detect how text data have shown on first text, , how have remaining text data set on next flip.
i searched many times there function visible text on text view, there no solution that, logics there not working me.
thanks.
public int getellipsisstart (int line)
return offset of first character ellipsized away, relative start of line. (so 0 if beginning of line ellipsized, not getlinestart().)
this means can find out if text has been ellipsized or not this:
int ellipsisstart = mtextview.getlayout().getellipsisstart() > 0; if (ellipsisstart > 0) { // text has been ellipsized // text next page should // string nextpagetext = mystring.substring(ellipsisstart); } else { // text fits on first page }
but remember getlayout() return null before layout has been set, can use viewtreeobserver find out if layout has been laid out.
viewtreeobserver observer = mtextview.getviewtreeobserver(); observer.addongloballayoutlistener(new ongloballayoutlistener() { @override public void ongloballayout() { layout layout = textview.getlayout(); if ( layout != null) { // ellipsisstart } } });
Comments
Post a Comment