为高分辨率屏幕创建可用的工具栏 [英] Creating Usable Toolbar for High Resolution Screen

查看:292
本文介绍了为高分辨率屏幕创建可用的工具栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

高分辨率屏幕是旧消息,但由于某种原因,我们(和Eclipse的家伙)直到现在都不理解它们。嗯,我们不能再了。



我们想要做的是创建适用于正常显示器的Eclipse应用程序,但对于高分辨率显示器也是如此。现在,图标可以看到或点击。



此错误链接到这个(相当稀疏的)文档指出,我们只需要为 Image 使用一个新的构造函数。好的,所以我们需要创建我们自己的 ImageDataProvider 的实现。



虽然这可能适用于我们自己创建的图像,但它不适用于主要工具栏图标。



所以让我们从头开始一个全新的应用程序:我们将如何设置一切,使工具栏与新的API一起使用,以及各种屏幕?



(有一个类似的问题,但是从Eclipse用户的角度来看,而这个问题是从Eclipse应用程序开发人员的角度出发的。)

解决方案

当HiDPI模式缩放使用任何使用 ImageDescriptor.createFromURL 加载图像将寻找图像根据当前缩放比例,将 @ 2x @ 1.5x 附加到名称上(因此,例如 remove.png remove@2x.png )。这用于创建一个 ImageDataProvider



Eclipse将使用这个工具栏图像和许多其他的东西。


High resolution screens are old news, but for some reason we (and the Eclipse guys) ignored them until now. Well, we can't any longer.

What we want to do is create Eclipse applications that work for "normal" displays, but for high resolution ones, too. Right now the icons are way to small to see or click.

This bug links to this (rather sparse) documentation states we only need to use a new constructor for Image. Okay, so we need to create our own implementation of ImageDataProvider.

While that might work for the images we created ourselves, it does not work for the main tool bar icons.

So let's say we'll start a completely new application from scratch: how would we set up everything to make the toolbar work with the new API and so with all kinds of screens?

(There is a similar question, but it's from the perspective of an Eclipse user, while this question is from the perspective of a developer of an Eclipse application.)

解决方案

When HiDPI mode scaling is in use anything using ImageDescriptor.createFromURL to load images will look for a image with @2x or @1.5x appended to the name depending on the current scaling (so, for example, remove.png and remove@2x.png). This is used to create an ImageDataProvider.

Eclipse will use this for the tool bar images and many other things.

这篇关于为高分辨率屏幕创建可用的工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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