我有一个基本对象,它有3个属性:
我需要一个编辑器来使高度和宽度可编辑,我还想在Label中显示id.
问题是Label接受一个String而id是一个Integer.所以如果我尝试以下方法:
@UiField
Label id;
Run Code Online (Sandbox Code Playgroud)
我有这个错误:
[ERROR] Line 17: Type mismatch: cannot convert from Integer to String
Run Code Online (Sandbox Code Playgroud)
我可以使用以下代码解决此问题:
@UiField
@Ignore
Label myId;
...
void setId(Integer id){
this.myId.setText(""+id);
}
Run Code Online (Sandbox Code Playgroud)
但这意味着当我编辑()时,我必须手动调用setId().
有没有办法在设置id时自动更新标签的文本?
| 归档时间: |
|
| 查看次数: |
698 次 |
| 最近记录: |