有一串html格式的字符串:<h1>heading 1</h1><h2>heading 2</h2><h3>heading 3</h3><h4>heading 4</h4><h5>heading 5</h5><p>normal text style</p><p><strong>strong </strong></p><p><em>italic</em></p><p><span style="text-decoration: underline;">underline</span> </p>显示效果如图:在这里想问大家一个问题
我对EditText的文字进行编辑,还能返回如:
<h1>heading 1</h1><h2>heading 2</h2>我正在做测试<h3>heading 3</h3><h4>heading 4</h4><h5>heading 5</h5><p>normal text style</p><p><strong>strong </strong></p><p><em>italic</em></p><p><span style="text-decoration: underline;">underline</span> </p>或者
<h1>heading 1,我正在做测试</h1><h2>heading 2</h2><h3>heading 3</h3><h4>heading 4</h4><h5>heading 5</h5><p>normal text style</p><p><strong>strong </strong></p><p><em>italic</em></p><p><span style="text-decoration: underline;">underline</span> </p>分数不是上限,解决问题是关键

解决方案 »

  1.   

    无论加还减都是返回html的形式,也就是我后面给出的两种形式
      

  2.   

    StringBuilder append insert 不就可以了吗
      

  3.   

    EditText显示的是经过Html.fromHtml(String source)返回的字符串,是没有html标签
    编辑后的EditText文字,在保存时,需要返回原来的html标签,这样就不要打乱原有的显示,如果你没有<h1></h1>那么文字就会变小,你说呢