WebView 既不在浏览器中也不在应用程序中打开链接

时间:2020-12-28 06:49:16

标签: android webview

这是我的 WebView 代码:

String mimeType = "text/html";
String encoding = "utf-8";
String htmlText = itemJob.getJobDesc();

String text = "<html><head>"
        + "<style type=\"text/css\">@font-face {font-family: MyFont;src: url(\"file:///android_asset/fonts/custom.otf\")}body{font-family: MyFont;color: #0b0b0b;text-align:left;font-size:15px;margin-left:0px}"
        + "</style></head>"
        + "<body>"
        + htmlText
        + "</body></html>";
webView.loadDataWithBaseURL(null, text, mimeType, encoding, null);

当我点击 WebView 中的链接时,没有任何反应!如何在浏览器中打开链接?

1 个答案:

答案 0 :(得分:0)

使用这个..它对我来说非常有用。

希望这对你有用

wvDesciption.loadData("<p align='justify'>" + mCouresubModel.getDescription() + "</p>", "text/html; charset=UTF-8", null);
相关问题