【问题标题】:how to show html code in android webview from php web service如何从 php web 服务在 android webview 中显示 html 代码
【发布时间】:2016-01-12 11:15:03
【问题描述】:

我有一个 android 应用程序,该应用程序从我的 php json Web 服务中获取数据。我的 php 服务如何将我的 json 数据提供给我的 android apk 以显示 html 内容为真。我的 android apk 使用 textview 来显示我的文本内容。

我使用了“\n”或“<br>”,但它不起作用。

mysql $desc = 'satir1\nsatir2\n' ; 
//or $desc = 'satir1<br />satir2<br />' ;
$desc = trim(htmlspecialchars_decode($desc)) ; 
mysql insert into ........

【问题讨论】:

  • 你能显示你的代码吗
  • 请在问题中发布您的代码
  • 插入mysql时 $desc = 'satir1\nsatir2\n' ; //或 $desc = 'satir1
    satir2
    ' ; $desc = trim(htmlspecialchars_decode($desc)) ; mysql 插入........
  • 显示android webview的HTML内容或代码,我没听懂。

标签: php android html json textview


【解决方案1】:

你要做的第一件事是创建一个 webview 如下 http://developer.android.com/reference/android/webkit/WebView.html

然后使用 loadDatawithBaseURL.. 示例加载 json 内容 http://www.codota.com/android/methods/android.webkit.WebView/loadDataWithBaseURL

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-20
    • 1970-01-01
    • 2015-11-09
    相关资源
    最近更新 更多