Can I change the label of the “set” button in a Ti

2019-07-09 01:45发布

By default you have "set" and "cancel", I would like to change the "set" label to "Find".

Is it possible?

3条回答
劫难
2楼-- · 2019-07-09 02:04

Try

yourTimePickerDialog.setButton(BUTTON_POSITIVE, "Find", yourTimePickerDialog);
查看更多
Fickle 薄情
3楼-- · 2019-07-09 02:04
TimePickerDialog tp = new TimePickerDialog(this, mTimeSetListener, 0, 0, false);
tp.setButton(DialogInterface.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which)
    {
        if (which == DialogInterface.BUTTON_POSITIVE)
        {
        }
    }
});
tp.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which)
    {
        if (which == DialogInterface.BUTTON_NEGATIVE)
        {

        }
    }
});

try using the above code..

查看更多
狗以群分
4楼-- · 2019-07-09 02:17

Better create a xml file with time picker and two buttons as you need.

Then you can manually launch a alert dialog with view set to this xml file.

You can set the text as you want to both the buttons also you can manually handle the click events for both the buttons.

查看更多
登录 后发表回答