GWT Uibinder Image showing but not resizing
This image is showing but I can't resize it not matter the width or height values I use. Any thougt? Thankyou.
<ui:with field='res' type='com.hellomvp.client.resources.MyResources'/>
<ui:style>
.fortaImage { width:'50px'; height:'50px';}
</ui:开发者_StackOverflow社区style>
<g:DockLayoutPanel unit='EM'>
<g:north size="10">
<g:FlowPanel>
<g:Image styleName='{style.fortaImage}' resource='{res.fortaLogo}'/>
<g:InlineLabel>FortaService</g:InlineLabel>
<g:ListBox></g:ListBox>
<g:InlineLabel>DateIn</g:InlineLabel>
<d:DateBox></d:DateBox>
<g:InlineLabel>DateOut</g:InlineLabel>
<d:DateBox></d:DateBox>
<g:Button>Cerca</g:Button>
</g:FlowPanel>
</g:north>
</g:DockLayoutPanel>
When you use <g:Image resource="..."/>
, GWT uses a background image. Background images cannot be resized in CSS 2.1. (I really wish it was possible!)
All you can do is either have a 50x50px version of the image on the server, or use <g:Image url="..."/>
instead. This creates a normal <img src="..."/>
instead of the background image, but you can't specify a ClientBundle resource here.
addStyleNames="{style.fortaImage}"
not
styleName='{style.fortaImage}'
精彩评论