0

Maybe it is very simple, but I did found the solution. I just want to have an image (as simple as a "black triangle") near a menu item. If it is possible with UI binder, it would be better. I just know there is the .setHTML(html) function... I would like an example, where the image to load (the "black triangle") is a sprite...

Thanks you

1 Answers1

0

If you want to use sprites, you can basically adapt the example from this answer https://stackoverflow.com/a/4548524/291741

Then you can set the sprite on a simple <div>:

<g:MenuBar>
  <g:MenuItem>Tools
    <g:MenuBar vertical="true">
      <g:MenuItem>
        <div class="{myResources.myCss.myBackground}"/> Triangle
      </g:MenuItem>
    </g:MenuBar>
  </g:MenuItem>
</g:MenuBar>

But wouldn't it be easier to use a <g:Image resource="..."/> instead? (no, see comment)

Community
  • 1
  • 1
Chris Lercher
  • 37,264
  • 20
  • 99
  • 131
  • Hi Chris, thanks for the answer but I can not use the instead of the div (inside menuItem because I have an error saying : "Not allowed in an HTML context...". I think you have understood my case, but to illustrate it I want to do these 'dropdown menu button': http://code.shrapp.nl/google-plus-ui-buttons/demo.html –  May 12 '12 at 17:26