HTML文字列の部分文字列の正当性を揃える必要があるアプリを開発しています。
問題: 次のコードを使用して、webview を使用して HTML テキストの正当性を設定しました。
String htmlText = "<html><body style=\"text-align:justify\"> %s </body></Html>";
WebView webView = new WebView(SubProducts.this);
webView.loadData(String.format(htmlText, description), "text/html", "utf-8");
しかし、次のように部分文字列に同じアイデアを設定すると:
String htmlText = "<html><body style=\"text-align:justify\"> %s </body></Html>";
WebView webView = new WebView(SubProducts.this);
webView.loadData(String.format(htmlText, description.substring(1,170)), "text/html", "utf-8");
出力テキスト html text(
<html><body style=\"text-align:justify\"> %s </body></Html>)
これを達成する方法.誰でも私を助けることができますか? 前もって感謝します。