android4.0 觸摸屏幕,對話框會消失解決

 

4.0的對話框與2.X,3.X有不一樣之處,它會在對話框外任意點擊就會自動消失,

解決兩種:

void setCancelable(boolean flag)
Sets whether this dialog is cancelable with the BACK key.
void setCanceledOnTouchOutside(boolean cancel)
Sets whether this dialog is canceled when touched outside the window's bounds.

你可能感兴趣的:(android,dialog)