새로운 Activity를 띄우지 않고 Windows의 팝업 창처럼 그냥 창을 띄워 상태 알람/진행을 표시하는 녀석이다.
아래 Sample은 각각 종류별로 정리했다. 종류는 아래와 같다.
- Basic Alert - 아주 기본적인 Alert Dialog
- Button add - Dialog 창에 Button이 추가
- List type - 여러가지 항목을 선택
- CheckBox type - CheckBox가 포함
- RadioButton type - RadioButton이 포함(미리 체크 항목을 선택 할 수 있음)
- ProgressDialog type - 동그란 에니메이션이 동작함
- ProgressBar type - 막대 형태로 진행 상태를 표시함
- Custom Dialog - 임의 디자인을 적용
1. Basic Alert
|
AlertDialog.Builder ab = null; |
2. Button add
|
AlertDialog.Builder builder = new AlertDialog.Builder(this); |
3. List type
|
final CharSequence[] items = {"Red", "Green", "Blue"}; |
4. RadioButtons type
|
final CharSequence[] items = {"Red", "Green", "Blue"}; |
5. Checkboxes type
|
final CharSequence[] items = {"Red", "Green", "Blue"}; |
6. ProgressDialog type
|
private class ProgressDialogStop extends Thread |
|
ProgressDialog dialog = ProgressDialog.show(AlertDialogTest.this, "", |
7. ProgressBar type
|
private class ProgressBarStop extends Thread |
|
ProgressDialog progressDialog = null; |
8. CustomDialog type
|
별도 Dialog 타입 Layout을 설정해야 한다. <?xml version="1.0" encoding="utf-8"?> |
|
import android.app.Dialog;
|
|
Dialog dialog = new MyCustomDialog(this); |
9. CustomDialog type 2
위 8번 내용을 그대로 사용.
|
AlertDialog.Builder md = new AlertDialog.Builder(this); |
기본 참고 베이스에 적절히 응용하거나, 추가해서 쓰신다면 더 예쁘고 좋은 다이얼로그 만드실수 있을 겁니다.
'Android' 카테고리의 다른 글
| jar ? .. aar? 라이브러리. (1) | 2016.10.10 |
|---|---|
| startActivityForResult / onActivityResult (0) | 2013.10.01 |
| eclipse 이클립스 안드로이드 설치 (0) | 2013.08.15 |
| 안드로이드 웹뷰 다이얼로그 띄우기 [dialog] (0) | 2013.08.12 |
| 웹뷰 임시 정리 (0) | 2013.08.05 |

