Can you use Sprites as ThemeResources (e.g. for a Link icon)?


I’m using the Link component and set an icon via

Link l = new Link();
l.setIcon(new ThemeResource("../sampler/icons/icon_world.gif"));

as seen in the showcase.

My question is: is there any way to use a sprite as a theme resource and to set an offset for this sprite?


Hi Florian,

I don’t know if it is entirely possible (I’m not sure if you can set the offsets for an tag), but I wouldn’t recommend doing it anyway. The way to add icons using sprites is to add the icon as a background for the Link element wrapper in your theme, where you have all the power of CSS to help you.