java如何从swing到安卓进行视图更新?
安卓编程新手,但我想做的是,我有一段时间用Swing写的代码。我希望能够将其转换为在安卓系统中同样的功能。接口代码和类代码如下:
界面:
public interface CellView {
void update();
JComponent getComponent();
}
班级
public class ComponentCellView implements CellView {
private JComponent component;
public ComponentCellView(JComponent component) {
this.component = component;
}
public void update() { component.repaint(); }
public JComponent getComponent() { return component; }
}
安卓中是否有类似的功能,例如。repaint()或调用并返回特定视图的功能?我听过一些关于invalidate()方法的介绍,这可能会有所帮助,而且我相信适配器中存在一个getView方法,所以这可能是我需要为自己的自定义视图声明的内容。有什么想法吗? 谢谢
# 1 楼答案
我在Swing上做了很短的工作,但我不知道你想要什么样的功能。我只想确认一下你提到的几个
自定义视图示例如下所示: