Using the following code I am unable to break the line to 2.
builder.setMessage(Html.fromHtml("<b>"+"World"+"</b>+\n+second line"))
Result I get like: World+ +second line
If you are using Html.fromHtml()
then use <br/>
where you want a line break
for eg:
builder.setMessage(Html.fromHtml("<b>"+"World"+"</b><br/>"+"second line"))
and if not Html
and just String you can use \\n
where you want a line break
.
en..u can use '\\n',like that
ProgressDialog progressDialog=new ProgressDialog(MainActivity.this);
progressDialog.setMessage("Str1"+"\n"+"Str2"+"\n"+"Str3");
progressDialog.show();
you can try it.
您可以通过编写以下代码轻松地做到这一点:
builder.setMessage("First line \n"+"second line"));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.