我的印象是在.setStyleAttribute中支持'backgroundIamge',以允许用户通过以下内容在面板中设置背景图像:
setStyleAttribute("backgroundImage","url('myImageUrl')");
然而,当我尝试以下内容时:
var panel = app.createVerticalPanel().setId('panel')
.setStyleAttribute('text-align', 'center')
.setStyleAttribute('zIndex', '3')
.setStyleAttribute('position', 'fixed')
.setStyleAttribute('left', 10)
.setStyleAttribute('top', 10)
.setWidth(250)
.setHeight(150)
.setStyleAttribute('backgroundImage',"url('https://myImage.png')");
我无法在面板中生成背景图像。有趣的是完全相同的代码将在按钮中生成背景图像。我试过'背景'和'背景图像'也无济于事。面板不支持'backgroundImage',还是我错过了什么?
答案 0 :(得分:0)
我想通了......你需要使用createAbsolutePanel或为其他类型的面板添加一个空标签。