Pergunta

I wrote this code to make a TimePickerDialog box

btnDialBoxTime.setOnClickListener(new OnClickListener() {
    public void onClick(View arg0) {
        MyTimePickerDialog timePickerDialog = new MyTimePickerDialog(AdvancedCDT.this, android.R.style.Theme_DeviceDefault, timeSetListener, 0, 0, true);
        timePickerDialog.setTitle("Set hours and minutes"); 
        timePickerDialog.show();

    }

    });

The dialog box appear correctly but the Theme is white.

I would like to have it black/gray which is the default of my Nexus 7.

The android.R.style.Theme_DeviceDefault does not seem to function.

Foi útil?

Solução

Use one of the five built-in AlertDialog themes:

For instance:

    MyTimePickerDialog timePickerDialog = new MyTimePickerDialog(AdvancedCDT.this,
            TimePickerDialog.THEME_HOLO_DARK, timeSetListener, 0, 0, true);

Results

Example

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top