【发布时间】:2012-05-03 01:09:03
【问题描述】:
我试图让 HorizontalPanel 中的两个按钮显示在图像顶部。不是在上面,因为您会看到按钮,然后再往下看页面并看到图像,但是您看图像并且上面有按钮。
这是我目前在 Page.ui.xml 文件中的代码:
<g:FocusPanel ui:field="profileImagePanel" addStyleNames="{style.headerImage}">
<g:AbsolutePanel addStyleNames="{style.innerImagePanel}">
<g:Image ui:field="profileImage" addStyleNames="{style.profileImage}"/>
<g:HorizontalPanel ui:field="imageEditButtons" addStyleNames="{style.imageEditButtons}">
<w:MultiUseButton ui:field="clearImage" addStyleNames="{style.change}" type="secondary" text="{i18n.clearImage}" visible="false"/>
<w:MultiUseButton ui:field="changeImage" type="secondary" text="{i18n.changeImage}" visible="false"/>
</g:HorizontalPanel>
</g:AbsolutePanel>
</g:FocusPanel>
样式是:
.headerImage {
position: absolute;
top: 0;
left: 0;
width: 150px;
}
.profileImage {
width: 150px;
position: relative;
}
.change {
float: right;
}
.headerImage a {
display: block;
}
.imageEditButtons {
width:100%;
}
.innerImagePanel {
width:150px;
}
我尝试过使用 FlowPanel 而不是 AbsolutePanel,但这不起作用。我试过制作 profileImage position:relative 和 imageEditButtons position:absolute 但这会破坏页面其余部分的整个显示。我也尝试设置 imageEditButtons margin-top:-20px 但它位于图像下方而不是顶部。如果我将 HorizontalPanel 放在 Image 之前的 AbsolutePanel 中,则按钮位于图像上方,如果我尝试更改上边距,则会将按钮和 Image 向下移动。
我的想法已经不多了。任何有关如何使这项工作的建议将不胜感激。
【问题讨论】:
-
为什么你的标签Button的属性
visible处于false状态? -
它们一开始是隐藏的,然后当用户进入编辑模式时,它们在相关的 .java 文件中被设置为 true。
-
好吧,在这种情况下没有问题。
-
将图像作为背景不太适合我们使用图像的方式。请参阅我对您的回答的评论。
标签: css gwt uibinder gwt-widgets