Problem with DatePickerDialog on android

0

Hello, I have a problem in my DatePickerDialog, it works perfect in other projects, it takes the colors of the app, but in this project I need to use in the styles of the app which makes my DatePickerDialog fail, it shows me a green color, I do not understand how to change it with the account I use noactionbar.

public void onClick(View v) {
    if(v==seleccione_fecha){
        Calendar c = Calendar.getInstance();
        dia = c.get(Calendar.DAY_OF_MONTH);
        mes = c.get(Calendar.MONTH);
        anio = c.get(Calendar.YEAR);

        final DatePickerDialog datePickerDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {

            @Override
            public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {

                fecha_elegida.setText(dayOfMonth+"/"+(month+1)+"/"+year);
            }

        }
                ,anio,mes,dia);
        datePickerDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
        datePickerDialog.show();
    }
}

I would like to change that green to red, I do not understand why it turns green but I have no green color in my entire app.

    
asked by Matias Diaz 20.11.2017 в 21:25
source

1 answer

0

Change the creation of your DateTimePicker in this way so that it takes the style:

new DatePickerDialog(MainActivity.this, R.style.DialogTheme, new DatePickerDialog.OnDateSetListener() {

And create the style:

<style name="DialogTheme" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">@color/tucolor</item>
</style>
    
answered by 20.11.2017 в 21:30