背景图像缩放和容器codenameone中心

时间:2016-06-23 01:07:04

标签: codenameone

我正在尝试使用设置容器缩放的背景,并在中心覆盖coontainer的一些protion。当我使用如下的普通图像。它工作正常,但图像覆盖整个容器。

Image img = URLImage.createToStorage(placeHolder, url, url, URLImage.RESIZE_SCALE);
findContainerMain(f).setUIID("ContainerBgImage");
findContainerMain(f).getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_SCALED,true);
findContainerMain(f).getStyle().setBgImage(img, true);

但是当我使用缩放图像作为背景时,它不会显示任何图像只是白色背景。

Image img = URLImage.createToStorage(placeHolder, url, url, URLImage.RESIZE_SCALE).scaledHeight(50);
findContainerMain(f).setUIID("ContainerBgImage");
findContainerMain(f).getStyle().setBackgroundType(Style.BACKGROUND_IMAGE_SCALED,true);
findContainerMain(f).getStyle().setBgImage(img, true);

我如何获得所需的效果。

1 个答案:

答案 0 :(得分:0)

懒惰地获取URLImage并依赖于图像的动画属性来更新自身。

rock方法创建一个全新的图像对象,该对象没有与wood关联的提取属性。

相关问题