public BasicView(String name) {
super(name);
Button b = new Button("test test test");
this.getChildren().addAll(b);
width = MobileApplication.getInstance().getScreenWidth();
height = MobileApplication.getInstance().getScreenHeight();
VBox box = new VBox();
box.getChildren().add(b);
setCenter(box);
Text t = new Text(width/4,height/2,"OMG ITS TEXT ON THE SCREEN !!!! TEST TEST TEST TEST");
t.setWrappingWidth(100);
this.getChildren().add(t);
b.setOnAction(e -> this.rotate(t));
TextFlow tf = new TextFlow();
Text t1= new Text("This text is not bold ");
Text t2= new Text(",this part is,");
t2.setStyle("-fx-font-weight: bold");
t2.setFill(Color.RED);
Text t3= new Text("and this part is italic");
t3.setStyle("-fx-font-style: italic");
tf.setPrefSize(30,30);
tf.setMaxWidth(USE_PREF_SIZE);
tf.getChildren().addAll(t1,t2,t3);
tf.setStyle("-fx-background-color: red");
tf.setLayoutX(100);
tf.setLayoutY(100);
this.getChildren().addAll(tf);
}
生成的文本流不换行并且没有背景颜色。文本的 t3 部分也不以斜体显示。我曾尝试寻找答案,但一无所获。任何帮助将不胜感激。
编辑:我忘了提到我正在使用 gluon 移动插件来使用 javaFx 构建一个 android 应用程序。