0
當我使用警告對話框中,我可以通過添加一個「取消」按鈕:實現我自己的片段作爲DialogFragment
AlertDialog.Builder builder = new Builder(getActivity());
builder.setTitle("Students").setNegativeButton("Cancel",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
});;
現在我實現我自己的片段。我怎樣才能設置相同的取消按鈕?
感謝這個看上去有益的,但我遇到了疑難問題加入你建議的功能,我得到一個例外:requestFeature()必須在添加內容之前被調用。 – Libathos