search

Home  >  Q&A  >  body text

new to android. How to implement one paragraph of text, one picture and one paragraph of text like NetEase news page?

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?

曾经蜡笔没有小新曾经蜡笔没有小新2780 days ago1791

reply all(11)I'll reply

  • 黄舟

    黄舟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

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 13:32:18

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

    reply
    0
  • 黄舟

    黄舟2017-05-16 13:32:18

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

    reply
    0
  • 给我你的怀抱

    给我你的怀抱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

    reply
    0
  • 黄舟

    黄舟2017-05-16 13:32:18

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

    reply
    0
  • 仅有的幸福

    仅有的幸福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

    reply
    0
  • 怪我咯

    怪我咯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

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 13:32:18

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

    reply
    0
  • 我想大声告诉你

    我想大声告诉你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.

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-16 13:32:18

    Generally used directlyHtml5

    reply
    0
  • Cancelreply