java - 垂直图像作为水平图像加载
问题描述
我正在编写一个简单的应用程序,它基本上会加载一些图片并将它们显示给用户。问题是,当我初始化手机拍摄的垂直图像时,它无法识别图像是垂直的,只是交换了宽度和高度。
否则,如果我加载一个垂直图像,例如从互联网下载的,一切正常。
在这里,您可以看到我的应用程序和两张加载的图片。左边是下载的,垂直显示。但是用我的手机拍的那张不是垂直显示的。
这是我的课程/代码:
import javafx.scene.CacheHint;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
public class Picture {
String name;
String path;
String res;
String size;
ImageView iv;
Image image;
public Picture(String name, String path) {
this.image = new Image("file:" + path);
this.name = name;
this.path = path;
this.res = image.getWidth() + " x " + image.getHeight();
this.iv = new ImageView(image);
this.iv.setFitHeight(180);
this.iv.setFitWidth(180);
this.iv.setPreserveRatio(true);
this.iv.setCache(true);
this.iv.setCacheHint(CacheHint.SPEED);
this.iv.setStyle("-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 0);");
}
}
这是我的第一个问题,所以不要责怪我的布局;)
感谢对我的代码或问题的任何反馈。如果您需要整个代码,请告诉我。
谢谢你的帮助
解决方案
推荐阅读
- c# - 如何通过前几个字符过滤字符串
- javascript - 错误:在 Function.Module._resolveFilename 中找不到模块“配置”
- android - 从 Volley 中的刷新令牌获取访问令牌
- php - 如何将 TxtNation 字符串转换为数组?
- python - 如何抓取没有 href 属性的链接?
- node.js - 如何跳过 50 条记录,然后在 node.js 中使用 findOne 查询在 mongodb 中查找匹配的记录
- c++ - 如何手动遵循计算器的 C++ 语法?
- angular-directive - AngularDart:在结构指令中使用模板输入变量
- python - 如何按一列过滤数据并按另一列分组
- php - 添加代码以从另一个控制器运行