Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    IMG width issue

    Hi ,
    I am using <smartgwt.version>12.1-p20210219</smartgwt.version>

    i have used following code to set Image heigth and let framework handle the width so as to maintain aspect ratio.

    final Img frameImg = new Img(frameUrl);
    frameImg.setImageHeight(110);
    frameImg.setImageType(ImageStyle.CENTER);
    frameImg.setRedrawOnStateChange(false);
    frameImg.setShowDisabled(false);
    frameImg.setShowDown(false);
    frameImg.setShowFocused(false);
    frameImg.setShowRollOver(false);

    Here i have set ImageHeight to 110.

    My problem is that img tag inside the dom works as per above code(gtakes height of 110px and width according to aspect ratio).Refere captute1.png

    But outmost most div element of Img element behaves dfferently. (it takes height of 130px i,e entire layout height and widt fixed to 100px).refer capture2.png

    why is outer div behaving differntly.Should it not also have 110px height(as setImageHeight(110) and width as per aspect ratio).

    My problem is that since outer div does not take aspect ratio width , it is laways fixed to 100px due to which left of the next image is 100px which leads to overlapping to 2 images).Capture3.png

    Attaching screenshot.

    Please help
    Attached Files

    #2
    If the image is not already cached, there is no way to render it at it's "natural" aspect ratio. So you need to pre-cache the image before you draw the Img widget. You can do this via core GWT Image APIs if it is not possible to simply place an <img> tag in the host .html page.

    Comment

    Working...
    X