【问题标题】:Android newline in my EditText我的 EditText 中的 Android 换行符
【发布时间】:2011-04-11 21:41:07
【问题描述】:

我通过使用带有 utf8 编码的 json 从我的远程服务器获得了一些类似“第 1 行 \n 第 2 行”的数据,当我尝试将数据放入我的 EditText 时,换行符 \n 不起作用,尽管因为我使用数据库,所以使用 URLDecoder.decode() 取消转义数据。 任何建议

一切顺利。

【问题讨论】:

    标签: android json utf-8 android-edittext


    【解决方案1】:

    解决了,通过使用

    myString.replace("\\n", "\n");
    

    【讨论】:

      【解决方案2】:
      String value=userdataArrayList2[0].toString().trim().replace("\\n", "\n");
      

      在后端数据库中插入这样的数据:

      name is osama\nibrahim 
      

      结果:

      name is osama
      ibrahim
      

      【讨论】:

        猜你喜欢
        • 2015-05-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-31
        • 2018-10-15
        • 1970-01-01
        • 1970-01-01
        • 2014-07-30
        相关资源
        最近更新 更多