[英]How can I lay out text in multple lines in my FXML File and append them
In one of my FXML file, I have a text tag that look this 在我的一个FXML文件中,我有一个文本标签,看起来像这样
<TextFlow >
<Text text="There are 15 questions standing between you and a million dollar pay day! Each question is presented in multiple choice format. One of the four choices is the correct answer - your job is to pick the right one! The questions become more difficult as you progress through the game, but the potential payoff increases as well! Miss a question and the game is over." id="gameText" fill="white"/>
</TextFlow>
When I tried to do it in multiple lines like this 当我试图像这样多行
<TextFlow >
<Text text="There are 15 questions standing between you and a million dollar pay day!
Each question is presented in multiple choice format. One of the four choices is the
correct answer - your job is to pick the right one! The questions become more difficult
as you progress through the game, but the potential payoff increases as well! Miss a
question and the game is over." id="gameText" fill="white"/>
</TextFlow>
My output came out like this with the second method(The text tag with multiple lines) 我的输出是通过第二种方法输出的(多行文本标签)
The text tag that is a single straight line gives me the correct output but I would like to know if there is another way to layout the text correctly using the second method. 单个直线的文本标签为我提供了正确的输出,但是我想知道是否还有另一种方法可以使用第二种方法正确地布置文本。
As per the answer from here and here using CDATA within your XML may be the solution you are after. 根据从这里到这里的答案,在您的XML中使用CDATA可能是您想要的解决方案。
<TextFlow>
<Text id="gameText" fill="white">
<![CDATA[
There are 15 questions standing between you and a million dollar pay day!<br />
Each question is presented in multiple choice format. One of the four choices is the correct answer - your job is to pick the right one! The questions become more difficult as you progress through the game, but the potential payoff increases as well!<br />
Miss a question and the game is over."<br />
]]>
</Text>
</TextFlow>
This will bring back html line breaks within your text node which when rendered by the web browser should give you your desired result 这将在文本节点内带回html换行符,当由网络浏览器渲染时,该换行符将为您提供所需的结果
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.