AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.update_dialog_tittle));
builder.setMessage(updateInfo.getDescription());
builder.setCancelable(false);
updateinfo是javabean,是通过阅读网站XML,网站XML
获得的<?xml version="1.0" encoding="UTF-8"?><updateInfo><version>1.2</version><url>http://localhost:8080/test.apk</url><description>update\n1:test\n2:test\n3test\n4:test</description></updateInfo>
要显示的文本显示&#34; update \ n1:test \ n2:test \ n3 test \ n4:test&#34;,\ n display,no wrap effect
答案 0 :(得分:0)
试一试
如果您的XML用\n
替换<br>
<?xml version="1.0" encoding="UTF-8"><updateInfo><version>1.2</version><url>http://localhost:8080/test.apk</url><description>update<br>1:test<br>2:test<br>3:test<br>4:test</description></updateInfo></p> <br>
您可以尝试这样
builder.setMessage(Html.fromHtml(updateInfo.getDescription());