GWT FocusPanel setProperty(“左”,xx”)不工作

GWT FocusPanel setProperty(“左”,xx”)不工作,gwt,drag,Gwt,Drag,我正在实现“拖动”并应用“向左设置” 这是我的代码: scrollPanel.setWidget(focusPanel);//add a focusPanel to the existing scrollPanel focusPanel.setWidget(flowPanel); //add a flowPanelto the existing focusPanel flowPanel.add(image) // add a image to the flowPanel scrollPane

我正在实现“拖动”并应用“向左设置”

这是我的代码:

scrollPanel.setWidget(focusPanel);//add a focusPanel to the existing scrollPanel
focusPanel.setWidget(flowPanel); //add a flowPanelto the existing focusPanel
flowPanel.add(image) // add a image to  the flowPanel
scrollPanel.setPixelSize(滚动窗格宽度、滚动窗格高度) focusPanel.setPixelSize(图像宽度、图像高度)

放大图像,使图像大小大于滚动面板大小

尝试拖动要在scrollPanel内查看的图像

(1) 工作方式

flowPanel.getElement().getStyle().setPropertyPx("left",  offset );
拖动时,可以移动图像

(2) 不起作用

focusPanel.getElement().getStyle().setPropertyPx("left",  offset );
拖动时,图像无法移动。 也试试这个,没有运气 Widget focusPanelWidget=scrollPanel.getWidget(); focusPanelWidget.getElement().getStyle().setPropertyPx(“左”,偏移量)

所以任何人都可以帮助理解为什么“设置为左”不适用于focusPanel? 谢谢你的帮助


非常感谢

left
属性取决于
position
属性,请参阅。我想你应该加上
位置:相对。很有效,谢谢!