更改DatePickerDialog的按钮文本按钮、文本、DatePickerDialog

由网友(囚与你心牢)分享简介:我有一些麻烦改变对话框按钮的文字。I'm having some trouble changing the text of the buttons of the dialog.我试图用setButton(int whichButton,CharSequence text,DialogInterface.OnCli...

我有一些麻烦改变对话框按钮的文字。

I'm having some trouble changing the text of the buttons of the dialog.

我试图用

setButton(int whichButton,
          CharSequence text,
          DialogInterface.OnClickListener listener)

setButton(int whichButton, CharSequence text, Message msg)

但我想不出用什么作为第三个参数。我可以通过一个新的 OnClickListener ,但我想用回调 DatePickerDialog.OnDateSetListener

我想,当我设置一个新的监听器按钮 DateSetListener 不会再NE叫?

I guess when I set a new Listener to the Button the DateSetListener won't ne called anymore?

推荐答案

北京时间SET按钮正确的做法。作为听众只是通过对话框对象本身,因为 onDateSetListener 获取与对话的构造函数。

setButton ist the correct approach. As listener just pass the dialog object itself, because the onDateSetListener gets passed with the constructor of the dialog.

DatePickerDialog dpd = new DatePickerDialog(this, mDateSetListener, mYear_g, mMonth_g, mDay_g); 
dpd.setButton(DatePickerDialog.BUTTON_POSITIVE, "Button Text", dpd);
阅读全文

相关推荐

最新文章