new to android. How to implement one paragraph of text, one picture and one paragraph of text like NetEase news page?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-16 13:30:18
0
11
1765

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?

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(11)
黄舟

Of course there are other solutions, you can use RecyclerView/ListView to implement it, and use different layouts for text and pictures

洪涛

That’s right, it’s h5, including the SegmentFault problem interface, which is also made of h5.

黄舟

Isn’t this implemented using ListView? ListView combined with adapter can meet your needs

给我你的怀抱

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

黄舟

Open the display layout border on your phone and take a look again

仅有的幸福

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

刘奇

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

曾经蜡笔没有小新

TextView uses rich text functionSpannableto achieve mixed arrangement of images and text

我想大声告诉你

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.

淡淡烟草味

Generally used directlyHtml5

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template