带新行的AlertDialog消息. (\ n不起作用.) [英] AlertDialog message with new line. (\n doesn't work.)

查看:113
本文介绍了带新行的AlertDialog消息. (\ n不起作用.)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Android的AlertDialog中使用换行符. 我已经尝试过使用"\ n"字符,但是它不起作用.我看不到"\ n"字符,但文本不会自动换行.

I need to use a break-line in a AlertDialog on Android. I already tried with the "\n" character but it doesn't work. I don't see the "\n" character but the text wont wrap.

有帮助吗?

推荐答案

您可以使用Html.fromHtml("some string" + "<br>")使用跨区文本在某些textview元素上创建新行.

You can use Spanned text using Html.fromHtml("some string" + "<br>") to create new line on some textview element.

这篇关于带新行的AlertDialog消息. (\ n不起作用.)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆