<分区>
我在我的应用程序上使用了一个警告对话框,但当用户触摸到它外面时它会一直隐藏。 这是我的代码:
public class DialogMessageEnd extends DialogFragment
{
String winner;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the Builder class for convenient dialog construction
Snooker_Scoreboard ss = new Snooker_Scoreboard();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setCancelable(false);
builder.setMessage(ss.winnerPlayer + " won the match ("+ss.frame1ToPass+"-"+ss.frame2ToPass+")!")
.setPositiveButton("New Match!", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent i = new Intent(getContext(),PlayerSelection.class);
startActivity(i);
}
});
// Create the AlertDialog object and return it
return builder.create();
}
}
如你所见,我使用了
builder.setCancelable(false);
但还是没有解决问题。 你能帮助我吗?谢谢