我有一个 SimplePanel
,我试图以编程方式设置它的背景图像,但下面的方法不起作用。为什么?
this.coverImage.getElement().getStyle().setBackgroundImage("images/veg.jpg");
对于:
风格:
.coverImage{
width:400px;
background-color:#e5e5e5;
background-repeat: no-repeat;
height:190px;
z-index:-1;
}
但是,添加背景图像:url("images/veg.jpg")
有效。
最佳答案
你快明白了;)
this.coverImage.getElement().getStyle().setBackgroundImage("url('images/veg.jpg')");
关于GWT 无法将背景图像添加到简单面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31808578/