如果我做对了或者我遗漏了什么,我就不会。当我执行以下操作以在我的 YouTube 描述中创建一个新行时,它们出现不正确。
private static final String newLine = System.getProperty("line.separator");
mg.setDescription(new MediaDescription());
mg.getDescription().setHtmlContent("This is line one." + newLine + "This is line two." + newLine + newLine + "This is line three.");
YouTube 描述中的内容是这样的
This is line one.
This is line two. This is
line three.
什么时候应该这样出来。
This is line one.
This is line two.
This is line three.
我觉得我没有在这里做某事;如果我没有得到正确的布局作为我的最终结果。
最佳答案
添加换行符实际上不会在 HTML 中创建换行符。您需要使用 <br />
标签。
关于java - 在 JAVA 中换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11724482/