2011-03-29 2 views
1

하나의 버튼으로 AlertDialog를 만들고 싶습니다. 누군가 나를 안내 할 수 있습니까? 감사!AlertDialog에 단일 버튼이 있습니까?

+3

실마리가 있습니까? 언어, 플랫폼, 웹/데스크톱 –

+0

android에서 경고 대화 상자를 만들고 싶습니다. –

+0

작업중인 언어 및 플랫폼은 무엇입니까? 'AlertDialog'은 아마도 안드로이드에서 나왔을 겁니다. – jmccarthy

답변

2

당신이 할 수있는 예 :

new AlertDialog.Builder(this) 
.setIcon(R.drawable.icon) 
.setTitle("Error") 
.setMessage("Please fill out the entire form") 
.setPositiveButton("Close", new DialogInterface.OnClickListener() { 

    @Override 
    public void onClick(DialogInterface dialog, int which) { 

    } 
}) 
.create() 
.show() 
; 
0

사용 AlertDialog.Builder.

AlertDialog.Builder builder = new AlertDialog.Builder(this); 
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { 
    public onClick(DialogInterface dialog, int which) { 
     // do something interesting. 
    } 
}); 
// other code to customize the dialog 
Dialog d = builder.create(); 
관련 문제