猿问

如何在具有自定义标签的 xml 中添加新行?

我正在开发一个离线故事 android 应用程序。但它有一个非常大的问题。每当我在故事中添加一个段落但所有文本都在混合时。我的意思是段落没有显示。请参阅说明中的图片以正确理解。


示例 XML 代码:


<root>

  <story_id>1</story_id>

    <story_title>Half of the Profit</story_title>

    <story_date>25/07/2017</story_date>

    <story_des>A rich man wanted to give a great feast to his friends. He got all kinds of dishes prepared but he could not get fish. He offered a reward to the man who would bring it. After some time a fisherman brought a big fish.


        But the gate keeper would not let him in till he had promised to give him half the reward.


    The fisherman agreed. The rich man was highly pleased and wanted to give him a lot of money, but the fisherman refused to take it. Instead, he demanded a hundred lashes on his back. All were surprised. At last the rich man ordered a servant to give him a hundred lashes.


        When the fisherman had received fifty, he asked them to stop as he had a partner in the business.


    It was the gatekeeper. The rich man understood the whole thing. He was given the remaining fifty lashes dismissed from the service. The rich man gave the fisherman a handsome reward.

   </story_des>

</story>                                                              

</root>

输出:

它在应用程序中的外观截图


繁星淼淼
浏览 93回答 1
1回答

白猪掌柜的

使用<p>标签创建一个新段落,如下所示:<root>&nbsp; <story_id>1</story_id>&nbsp; &nbsp; <story_title>Half of the Profit</story_title>&nbsp; &nbsp; <story_date>25/07/2017</story_date>&nbsp; &nbsp; <story_des>&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;A rich man wanted to give a great feast to his friends. He got all kinds of dishes prepared but he could not get fish. He offered a reward to the man who would bring it. After some time a fisherman brought a big fish.&lt;/p&gt;&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;But the gatekeeper would not let him in till he had promised to give him half the reward.&lt;/p&gt;&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;The fisherman agreed. The rich man was highly pleased and wanted to give him a lot of money, but the fisherman refused to take it. Instead, he demanded a hundred lashes on his back. All were surprised. At last the rich man ordered a servant to give him a hundred lashes.&lt;/p&gt;&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;When the fisherman had received fifty, he asked them to stop as he had a partner in the business.&lt;/p&gt;&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;It was the gatekeeper. The rich man understood the whole thing. He was given the remaining fifty lashes dismissed from the service. The rich man gave the fisherman a handsome reward.&lt;/p&gt;&nbsp; &nbsp;</story_des></story>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</root>
随时随地看视频慕课网APP

相关分类

Java
我要回答