iPhone6:InteractionDiaog 显示得太靠下;内容隐藏
iPhone 6: InteractionDiaog appears too far down; content hidden
我正在尝试在 Codename One 应用程序中实现聊天功能,主要使用教程示例“Building a Chat App with Codename One”。其中一部分是当有人试图与您联系时弹出的 InteractionDialog。这在模拟器和我的 Android 单元上看起来不错,但在 iPhone 6 上,对话框似乎画得太低了,导致只有标题可见。
这是程序代码:
int h = toast.getPreferredH();
int dh = Display.getInstance().getDisplayHeight(); // just for debugging
toast.show(Display.getInstance().getDisplayHeight() - h - 10, 10, 10, 10);
UITimer uit = new UITimer(() -> {
toast.dispose();
});
吐司高度,显示高度:
模拟器:h=221,dh=480
Android: h=359, dh=1674
iPhone 6: h=304, dh=1334 (这个离底部太近了)
屏幕指标是否有问题,我该如何解决?我之前在 InteractionDialog 放置方面遇到过一些其他类似的问题。
我很乐意展示一些屏幕截图,但我还不能post那么多链接。
我认为聊天应用程序的代码在这里可能有点错误更改此:
int h = toast.getPreferredH();
int dh = Display.getInstance().getDisplayHeight(); // just for debugging
toast.show(Display.getInstance().getDisplayHeight() - h - 10, 10, 10, 10);
为此:
int h = toast.getPreferredH();
int dh = Display.getCurrent().getContentPane().getHeight();
toast.show(dh - h - 10, 10, 10, 10);
分层窗格(InteractionDialog 所在的位置)仅位于内容窗格区域的顶部,而不是整个显示高度,因此不考虑标题 area/statusbar 区域。
仅供参考,在即将推出的版本中,我们将拥有新的 ToastBar component。
我正在尝试在 Codename One 应用程序中实现聊天功能,主要使用教程示例“Building a Chat App with Codename One”。其中一部分是当有人试图与您联系时弹出的 InteractionDialog。这在模拟器和我的 Android 单元上看起来不错,但在 iPhone 6 上,对话框似乎画得太低了,导致只有标题可见。
这是程序代码:
int h = toast.getPreferredH();
int dh = Display.getInstance().getDisplayHeight(); // just for debugging
toast.show(Display.getInstance().getDisplayHeight() - h - 10, 10, 10, 10);
UITimer uit = new UITimer(() -> {
toast.dispose();
});
吐司高度,显示高度:
模拟器:h=221,dh=480
Android: h=359, dh=1674
iPhone 6: h=304, dh=1334 (这个离底部太近了)
屏幕指标是否有问题,我该如何解决?我之前在 InteractionDialog 放置方面遇到过一些其他类似的问题。
我很乐意展示一些屏幕截图,但我还不能post那么多链接。
我认为聊天应用程序的代码在这里可能有点错误更改此:
int h = toast.getPreferredH();
int dh = Display.getInstance().getDisplayHeight(); // just for debugging
toast.show(Display.getInstance().getDisplayHeight() - h - 10, 10, 10, 10);
为此:
int h = toast.getPreferredH();
int dh = Display.getCurrent().getContentPane().getHeight();
toast.show(dh - h - 10, 10, 10, 10);
分层窗格(InteractionDialog 所在的位置)仅位于内容窗格区域的顶部,而不是整个显示高度,因此不考虑标题 area/statusbar 区域。
仅供参考,在即将推出的版本中,我们将拥有新的 ToastBar component。