I know that TextView displays text and ImageView displays pictures. However, news content is dynamic and may include multiple texts and images, and the number is variable. How to achieve this?
And like editors, they use an Html editor such as CKEditor to edit news content and save a piece of text in html format in the field. It shouldn’t be possible with TextView and ImageView, right? I haven't seen any control with this function.
Is it made into an H5 page and displayed with WebView? Is there any other plan? How does NetEase News do it?
黄舟2017-05-16 13:32:18
Of course there are other solutions, you can use RecyclerView/ListView to implement it, and use different layouts for text and pictures
PHP中文网2017-05-16 13:32:18
That’s right, it’s h5, including the SegmentFault problem interface, which is also made of h5.
黄舟2017-05-16 13:32:18
Isn’t this implemented using ListView? ListView combined with adapter can meet your needs
给我你的怀抱2017-05-16 13:32:18
Basically, news pages are implemented in HTML5. This is the advantage of HTML5. Because news editors edit rich text, it is most convenient to display it directly in the form of HTML5
仅有的幸福2017-05-16 13:32:18
A picture displayed by default. The data is displayed after the data is loaded. It is actually a state before the data is loaded. It used to be a blank page
怪我咯2017-05-16 13:32:18
What you are talking about is rich text display. In fact, TextView can do it. It loads html data and parses it.
You can check out this library: https://github.com/Sufficient...
Of course, you can also use WebView
曾经蜡笔没有小新2017-05-16 13:32:18
TextView uses rich text functionSpannable
to achieve mixed arrangement of images and text
我想大声告诉你2017-05-16 13:32:18
The display of layout boundaries is more reliable. Since you want to imitate others, you have to know what they are using. Generally speaking, H5 has the best display effect, but it needs to deal with the interaction problem with the native one; then rich text is more difficult to control, and the text There are a series of issues such as styles and picture sizes; finally, the method of matching different item styles through viewtype is also a good method, and there should not be too many reference codes.