如何使用可在应用上的任何位置调用的文本框创建单个弹出式布局。请参阅下面我的意思的伪代码;
PopUpClass popup;
private static Singleton instance = null;
class Singleton {
if(instance == null) {
instance = new Singleton ();
// Instantiate a class pop up class layout
popup = new PopUpClass(); // I dont know how to create this one
}
return instance;
}
SomeClass {
private buttonClicked {
Singleton singleton = new Singleton();
PopUpClass popup = singleton.popup;
//add the pop up class to current view
}
}
这意味着我只想创建一次弹出类,以便在某些类上完成的布局上的任何文本也可以在其他类上显示。