Android講義—對話框
Android提供四種常用的對話框
1:AlertDialog:功能最豐富的對話框
2:ProgressDialog:進度對話框
3:DatePickerDialog:日期選擇對話框
4:TimePickerDialog:時間選擇對話框
AlertDialog可以分四個區如圖所示
圖標區
標題區
內容區
按鈕區
創建AlertDialog的步驟:
1:創建AlertDialog.Builder對象
2:調用對象的setTitle或者setCustomTitle設置標題
3:調用對象的setIcon設置圖標
4:調用相關方法設置內容
5:調用對象的setPositiveButton,setNegativeButton,setNeutralButto方法添加按鈕
6:調用對象的create方法創建對象,調用show方法顯示出來