我无法通过触摸外界找到解决微调模式对话框的解决方案。如何在对话框视图之外触摸时取消微调模式对话框
我知道Dialog中的dialog.cancle()有一个方法。但是有没有办法取消微调模式对话框?
谢谢..
我无法通过触摸外界找到解决微调模式对话框的解决方案。如何在对话框视图之外触摸时取消微调模式对话框
我知道Dialog中的dialog.cancle()有一个方法。但是有没有办法取消微调模式对话框?
谢谢..
创建一个自定义的微调类,并覆盖下面的方法: 创建一个自定义的微调类,并覆盖下面的方法:
@Override
public boolean performClick() {
this.isDropDownMenuShown = true; //Flag to indicate the spinner menu is shown
return super.performClick();
}
在我的活动,覆盖的方法onWindowFocusChanged(boolean hasFocus)。如果hasFocus == true & &#1中的标志设置为true,那么微调器已被解除(可以通过选择或轻敲微调器外部)。
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (actionBarSpinner.isDropdownShown() && hasFocus) {
actionBarSpinner.setDropdownShown(false);
//Do you work here
}
我可以在片段内使用这个吗? –
您可以通过使用此链接在fragmnet中实现onWindowFocusChanged ... http://stackoverflow.com/a/30130065/4360419 –
WindowFocus没有工作 –
任何人都会遇到这样的问题? –