We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我尝试创建了一个全屏对话框用来实现搜索功能, 我希望对话框中的内容可以在下次显示的时候保留, 我的代码是: private void showSearchDialog(){ if (mSearchDialog == null) { mSearchDialog = FullScreenDialog.show(this, R.layout.dialog_search, new FullScreenDialog.OnBindView() { public void onBind(FullScreenDialog dialog, View rootView) { } }).setTitle("搜索").setOkButton("关闭"); } else { mSearchDialog.show(); } } 但是我在第二次调用showSearchDialog()的时候对话框并没有显示, 我调查到了BaseDialog的showDialog(int style)方法, 里面有一个步骤: if (isAlreadyShown) { return; } isAlreadyShown = true; 变量isAlreadyShown在被显示一次后被设置为true, 但是并没有在dismiss后被设置为false, 导致dialog无法复用.
private void showSearchDialog(){ if (mSearchDialog == null) { mSearchDialog = FullScreenDialog.show(this, R.layout.dialog_search, new FullScreenDialog.OnBindView() { public void onBind(FullScreenDialog dialog, View rootView) { } }).setTitle("搜索").setOkButton("关闭"); } else { mSearchDialog.show(); } }
showSearchDialog()
BaseDialog
showDialog(int style)
if (isAlreadyShown) { return; } isAlreadyShown = true;
isAlreadyShown
希望能快点修复
The text was updated successfully, but these errors were encountered:
另外, 因为FullScreenDialog的构造方法是private的, 我甚至无法通过继承FullScreenDialog的方法解决这一问题, 我只能写一个MyFullScreenDialog继承自BaseDialog并将FullScreenDialog的全部代码复制其中, 然后在'doDismiss'方法中加入isAlreadyShown = false来解决这一问题
FullScreenDialog
MyFullScreenDialog
isAlreadyShown = false
Sorry, something went wrong.
值得庆幸的是, isAlreadyShown并不是私有变量, 这使得我还有操作的余地
就算是私有,反射也能拿到
No branches or pull requests
我尝试创建了一个全屏对话框用来实现搜索功能, 我希望对话框中的内容可以在下次显示的时候保留, 我的代码是:
private void showSearchDialog(){ if (mSearchDialog == null) { mSearchDialog = FullScreenDialog.show(this, R.layout.dialog_search, new FullScreenDialog.OnBindView() { public void onBind(FullScreenDialog dialog, View rootView) { } }).setTitle("搜索").setOkButton("关闭"); } else { mSearchDialog.show(); } }
但是我在第二次调用
showSearchDialog()
的时候对话框并没有显示, 我调查到了BaseDialog
的showDialog(int style)
方法, 里面有一个步骤:if (isAlreadyShown) { return; } isAlreadyShown = true;
变量
isAlreadyShown
在被显示一次后被设置为true, 但是并没有在dismiss后被设置为false, 导致dialog无法复用.希望能快点修复
The text was updated successfully, but these errors were encountered: