Dialog 메시지를 HTML
AlertDialog.Builder ab = null;
ab = new AlertDialog.Builder( HelloAndroid2Activity.this );
ab.setMessage( Html.fromHtml("<b><font color=#ff00ff> HTML View</font></b><br>Android.com"));
ab.setPositiveButton(android.R.string.ok, null);
ab.setTitle( "Basic Alert Dialog" );
ab.show();
OK/Cancel Dialog
AlertDialog.Builder closeConfirm = new AlertDialog.Builder(xxxActivity.this);
closeConfirm.setTitle(title);
closeConfirm.setMessage(msg );
closeConfirm.setNegativeButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
closeConfirm.setPositiveButton("cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
closeConfirm.show();
AlertDialog.Builder ab = ...
...
AlertDialog dialog = ab.show(); TextView messageText = (TextView)dialog.findViewById(android.R.id.message); messageText.setGravity(Gravity.CENTER);
HTML 사용시 개행
confirm.setMessage("ブラウザで開きます。"+"\n"+"よろしいですか。");
배경을 눌러 다이어로그가 사라지는 것을 방지하려면
closeConfirm.setCancelable(false); // 취소불가
< 참조 URL >
댓글
댓글 쓰기