java - 如何在 FXML 中直接在图像下方对齐文本?
问题描述
在 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>
文字显示在每张图片的前面。我想在每个图像下精确对齐 ehe 文本。
怎么做?
这就是它现在的样子:
解决方案
推荐阅读
- matlab - 从 Octave 的 fminunc 到 Julia 的带参数的梯度函数优化
- python - 在一个文件中生成多个随机 DNA 序列,连续不超过 3 个重复字母
- python - 如何检查matplotlib中的子图是否为空
- c++ - Xcode Sanitizer 如何启用
- rust - E0308 在过滤器中使用闭包时类型不匹配(“一种类型比另一种更通用”)
- sql - Oracle SQL - 我可以在 DDL 的 CHECK 约束中使用子查询吗?
- clang-format - 即使有注释,如何在同一行强制使用括号
- javascript - 如何检测 Angular 中选择了 mat-autocomplete 选项?
- go - 扩展或解包结构作为测试的输入参数
- html - Gatsby 将 lang 属性设置为 html