我和here有同样的问题。
有没有办法覆盖onResize方法并在uibinder中使用它?
SplitLayoutPanel mainPanel = new SplitLayoutPanel() {
@Override
public void onResize() {
super.onResize();
//some other resizing stuff
}
};发布于 2013-04-07 05:55:02
是。定义类:
package com.foo;
public class MySplitLayoutPanel extends SplitLayoutPanel() {
@Override
public void onResize() {
super.onResize();
//some other resizing stuff
}
};然后将类所在的包绑定到您选择的xml名称空间(这不会与UiBinder模板中定义的其他名称空间冲突):
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:foo='urn:import:com.foo'>然后通过名称空间引用您的类(就像您对常用g名称空间的其他小部件所做的那样):
<foo:MySplitLayoutPanel />这是针对UiBinder部分的,但我认为您链接的答案根本不是一个解决方案,因为当浏览器窗口调整大小时,也将调用(并且主要是) onResize()。
https://stackoverflow.com/questions/15852062
复制相似问题