简体   繁体   English

如何在Eclipse RCP ImageDescriptor中使用动画GIF

[英]How to use an animated GIF in Eclipse RCP ImageDescriptor

I want to use an animated GIF in an ImageDescriptor . 我想在ImageDescriptor中使用动画GIF。 I'm aware eclipse has other ways of animating gifs using manual threads that read the image as an input stream. 我知道eclipse有其他方法可以使用手动线程来动画gif,这些线程将图像作为输入流读取。 However that won't work for the ImageDescriptor API as it takes a file as input, not a stream. 但是,这对ImageDescriptor API不起作用,因为它将文件作为输入而不是流。 The reason I want to use an ImageDescriptor is because the ActionBar API only accepts ImageDescriptors for creating buttons with image icons. 我想使用ImageDescriptor的原因是因为ActionBar API只接受ImageDescriptors来创建带图像图标的按钮。 So in short, is there away to add an animated GIF icon/button to an Eclipse's View's Action bar? 简而言之,是否可以在Eclipse的View的Action栏中添加动画GIF图标/按钮?

I don't think there is a straight forward way. 我不认为有一种直截了当的方式。 You need to use timers and animate the gif yourself. 你需要使用计时器并自己动画gif。 Eclipse platform itself does that in few places (Eg: the browser view animation when page is loading) Eclipse平台本身在很少的地方做到这一点(例如:加载页面时的浏览器视图动画)

The ImageDescriptor can accept an url as input param: ImageDescriptor可以接受url作为输入参数:

ImageDescriptor id = Activator.getImageDescriptor("/icons/yourGif.gif");

Hope it works :-) 希望它有效:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM