androidandroid-layouttimepickerdialog

TimePickerDialog doesn't show properly in Android 6


i'm using DatePickerDialog to select time on my app. When I run my app on a device with Android 5 as OS the dialog shows properly, meanwhile if i run my app on a device with Android 6 this is what the dialog looks like:

enter image description here

Could someone help me?


Solution

  • I solved the issue changing the way that the TimePickerDialog was being created.

    I had this code :

        Calendar c = Calendar.getInstance();
        return new TimePickerDialog(getContext(), myTimeListener, c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), true);
    

    I changed the 2nd line for this one:

    Calendar c = Calendar.getInstance();
        return new TimePickerDialog(getContext(), R.style.AppTheme,  myTimeListener, c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), true);