1
我嘗試使用綠色和紅色顏色將顏色設置爲正面和負面按鈕,併爲按鈕中的文本設置一些字體。你能不能讓我知道如何做到這一點?AlertDialog按鈕 - 如何設置顏色並將文本字體更改爲+ ve和-ve按鈕
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()){
case R.id.bNewTicket:
// custom dialog
LayoutInflater li = LayoutInflater.from(context);
final View promptsView = li.inflate(R.layout.homepagedialognewticket, null);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
alertDialogBuilder.setView(promptsView);
// set dialog message
alertDialogBuilder.setPositiveButton("Go", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
}
})
.setNegativeButton("Back",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
break;
}
}