Splitting a TextView into multiple TextViews relative to screen height

倖福魔咒の 提交于 2019-12-06 07:23:06

问题


So I have what I consider a rather complex problem. I have this massive TextView that is several screen lengths long. What I want to do is split the TextView up into smaller TextViews, each the height of the visible screen (So no vertical scrolling), and place the smaller TextViews in a horizontal-scrolling Gallery. I can do the latter no problem, but I can't think of a good way to break up the TextViews.

It's also worth noting the TextView contains many different styled text within it (different sizes, spacing, etc).

I'm not necessarily looking for solutions, but suggestions would be helpful and appreciated.


回答1:


You should take a look at AndroViews or android-viewflow. They provide the horizontal paging that you're talking about, with android-viewflow being backed by an adapter.

In terms of splitting up the TextView, you can subclass the onMeasure() and start figuring out sizes there. You could also look into seeing how FBReader does it, as it pretty much does exactly what you're talking about.



来源:https://stackoverflow.com/questions/6270579/splitting-a-textview-into-multiple-textviews-relative-to-screen-height

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!