跨平台用户界面间距/填充 [英] Cross platform UI spacing/padding

查看:101
本文介绍了跨平台用户界面间距/填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用SWT UI库和MigLayout布局库编写了Java UI.

I have written a Java UI using the SWT UI library and the MigLayout layout library.

此页面显示了Windows,Linux和OSX上的UI的屏幕截图: http://mchr3k.github.com/org.intrace/screenshots.html

This page shows screenshots of the UI on Windows, Linux and OSX: http://mchr3k.github.com/org.intrace/screenshots.html

在Linux和OSX上,我的UI具有更多的填充和间距,我觉得这浪费了很多屏幕空间.这些平台正常吗?如果没有,解决此问题的最佳方法是什么?

On Linux and OSX my UI has a lot more padding and spacing which I feel wastes a lot of screen space. Is this normal for these platforms? If not, what is the best way to work around this?

链接的屏幕截图现已更新,并且在OSX上不再显示额外的间隙,因为我已将某些UI元素的边距明确设置为0.对平台而言是正确的.

the linked screenshots have now been updated and no longer show an extra gap on OSX as I have explicitly set the margins on some of my UI elements to 0. The OSX UI is still quite spaced out but I assume that this is correct for the platform.

推荐答案

这是MigLayout的创建者Mikael Grev.

This is Mikael Grev, the creator of MigLayout.

正如其他人所述,这是MigLayout的功能.默认情况下,不是使用x个像素(您当然也可以使用它),而是使用相关,不相关和段落之类的间隙.这些对应于不同UI工具包中的不同大小.例如,在OS X上,建议的组件之间的空白要比Windows上的大.

As someone else mentioned this is a feature of MigLayout. Instead of using x number of pixels (you can of course use that too) by default it is using gaps like related, unrelated and paragraph. These correspond to different sizes in different UI toolkits. For instance on OS X the recommended white space between components is larger than on Windows.

所以,是的,这就是它的外观,对于本机OS X用户而言,它看起来是正确的.

So, yes, this is how it's supposed to look and it will look correct for a native OS X user.

在OS X和Windows中,输出"窗格的底部似乎都有太多空白.

You do seem to have too much white space at the bottom of the Output pane though, in both OS X and Windows.

您可以在MigLayout中使用PlatformDefaults类来强制平台或更改默认间距.如果您想了解幕后情况,请检查源代码.

You can use the PlatformDefaults class in MigLayout to either force a platform or to change the default gaps. Check the source code if you want to know what's happening behind the scenes.

请记住,这是一个功能,因此每个开发人员都不必跟踪间距如何在不同平台上看起来像,这很难.

And remember, this is a feature so that every developer won't have to keep track of how to spacing should look like on different platforms, which is kind of hard.

干杯, 米卡尔(Mikael)

Cheers, Mikael

这篇关于跨平台用户界面间距/填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆