【问题标题】:Centering an Image within the ImageView?在 ImageView 中居中图像?
【发布时间】:2013-06-05 00:47:30
【问题描述】:

我的问题很简单。在 ImageView 中,图像位于左上角。我希望它在中心。有没有办法做到这一点?

注意:我的问题不是问如何将 ImageView 在其父级中居中,例如 this Android question,而是将实际图像居中 ImageView。

提前致谢。

【问题讨论】:

  • 你在使用Group布局吗?
  • 不,我不是。我应该吗?
  • 不,我刚刚在StackPane 中查看了ImageView,它位于中心位置。
  • 这不是关于 ImageView,而是关于 inside 的内容。实际图像。在 ImageView 中居中。

标签: java image javafx-2


【解决方案1】:

没有“图像位于左上角”之类的东西。 JavaFX ImageView 有一个名为 viewport 的属性,它定义了图像的哪些部分是可见的。所以你不能重新定位图像本身 - 你必须重新定义它的视图。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-23
    • 2011-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多