Android的viewpager包含seprated到页面的长文本 [英] android viewpager to contain a long text seprated to pages
问题描述
我有一个 viewPager
我的应用程序。我想在 viewPager
把文本长块。我不想文本是滚动的,我希望它被分离或分开来的页面,当用户页面它显示的文字在其他页面的其余部分。
I have a viewPager
in my app. I want to put a long block of text in the viewPager
. I don't want the text to be scrollable, I want it to be separated or parted to pages, and when the user pages it shows the rest of text in the other pages.
我该如何处理这个?
推荐答案
Android的使用(镗|静态|动态)布局类来衡量和文本换行,论文类取宽度作为构造参数,并会calc下你的文本总高度,他们还提供像getLineHeight(INT线)方法来获得行信息,这样你就可以算出字符串根据这些信息所抵消。我创建一个类来做到这一点,在这里看到我的回答:<一href=\"http://stackoverflow.com/a/30468884/2800351\">http://stackoverflow.com/a/30468884/2800351
Android use (Boring|Static|Dynamic)Layout classes to measure and wrap text, Theses class take width as constructor param and will calc the total height of you text, they also provide methods like getLineHeight(int line) to get line info, so you can calculate String offset according to these info. I create a class to do this, see my answer here: http://stackoverflow.com/a/30468884/2800351
这篇关于Android的viewpager包含seprated到页面的长文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!