在HTML5中,要在图像正下方显示文本,我们可以使用<figcaption>
。
<figure>
<img src="img.jpg" alt="my img"/>
<figcaption> Your text </figcaption>
</figure>
现在,我正在开发JavaFX应用程序,我想在每个图像下面直接显示下一个。 在主要方面,我有一个for循环,用于生成这些图像和文本。
在FXML中,我有
<HBox xmlns:fx="http://javafx.com/fxml" fx:controller="sample.AudioButtonController" >
<padding>
<Insets topRightBottomLeft="30" />
</padding>
<children>
<ImageView
fitHeight="120" fitWidth="120" fx:id="image" onmousepressed="#mousepressed">
</ImageView>
<Text fx:id="text"/>
</children>
</HBox>
文本显示在每个图像的前面。我想在每个图像的正下方对齐文本。
该怎么做?
这是现在的样子: