刷新对话框的内容 [英] Refresh contents of dialog
本文介绍了刷新对话框的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要每当对话框准备DRAWIN更新定制对话框的内容。我不知道这可能是直接刷新或者如果我需要先关闭并重新instatiate呢?
I need to update a custom dialog content whenever that dialog is ready to be drawin. I am not sure this could be refreshed directly or if I need to close it first and re-instatiate it?
推荐答案
获取该对话框使用和[文章]无效的视图。
Get the view that the Dialog is using and [post]invalidate it.
而不是 Dialog.setContentView的(INT)
;
做这样的事情:
public class MyDialog {
View v = null;
public Dialog show(Context context) {
Dialog d = new Dialog(context);
v = LayoutInflater.from(context).inflate(R.layout.resource, null);
d.setContentView(v);
return d.show();
}
public void update() {
v.invalidate();
}
}
这篇关于刷新对话框的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文