GWT 无法将背景图像添加到简单面板
GWT Unable to add background image to Simple Panel
我有一个 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')");
我有一个 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')");