본문 바로가기
IT/Android

Kotlin] 안드로이드 Dialog 알림 나타나게 하기

by 깻잎쌈 2020. 4. 19.
반응형
 

대화상자  |  Android 개발자  |  Android Developers

대화상자는 사용자에게 결정을 내리거나 추가 정보를 입력하라는 프롬프트를 표시하는 작은 창입니다. 대화상자는 화면을 가득 채우지 않으며 보통은 사용자가 다음으로 계속 진행하기 전에 조치를 취해야 하는 모달 이벤트에 사용됩니다. 대화상자 디자인 언어 권장 사항을 비롯한 여러 가지 대화상자 디자인 방법에 관련된 정보는 대화상자 디자인 가이드를 읽어보세요. Dialog 클래스가 대화상자의 기본 클래스이지만, Dialog를 직접 인스턴스화하는 것은 삼가야 합니다.

developer.android.com

private fun OnClickHandler() {
        val builder = AlertDialog.Builder(this)

        builder.setTitle("11")
            .setMessage("22")
            .setPositiveButton("ㄱㄱㄱ",
                DialogInterface.OnClickListener { dialog, id ->
                })
            .setNegativeButton("ㄴㄴㄴ",
                DialogInterface.OnClickListener { dialog, id ->

                })

        val alertDialog = builder.create()

        alertDialog.show()
}

 

반응형

댓글