0

In my app I can see this type DatePickler

enter image description here

But I want to use this type style,

enter image description here

Do not take into account the color in the photos, I just need to change the shape.

In this Material web can find more pictures type of DatePickler that I need:

https://material.io/guidelines/components/pickers.html#

user2983041
  • 1,761
  • 4
  • 19
  • 31

1 Answers1

0

You can use this link.

http://www.android-examples.com/change-datepickerdialog-theme-in-android-using-dialogfragment/

DialogFragment For DatePicker:

public static class DatePickerDialogTheme extends DialogFragment implements DatePickerDialog.OnDateSetListener{

     @Override
     public Dialog onCreateDialog(Bundle savedInstanceState){
     final Calendar calendar = Calendar.getInstance();
     int year = calendar.get(Calendar.YEAR);
     int month = calendar.get(Calendar.MONTH);
     int day = calendar.get(Calendar.DAY_OF_MONTH);


//for DatePicker with diffrent style

 DatePickerDialog datepickerdialog = new DatePickerDialog(getActivity(),
 AlertDialog.THEME_DEVICE_DEFAULT_DARK,this,year,month,day);



     return datepickerdialog;
     }

     public void onDateSet(DatePicker view, int year, int month, int day){

     TextView textview = (TextView)getActivity().findViewById(R.id.textView1);

     textview.setText(day + ":" + (month+1) + ":" + year);

     }
     }

Open DatePicker on Button Click:

btn.setOnClickListener(new View.OnClickListener() {

 @Override
 public void onClick(View v) {
 // TODO Auto-generated method stub

 DialogFragment dialogfragment = new DatePickerDialogTheme();

 dialogfragment.show(getFragmentManager(), "Theme");

 }
 });

Code is same as you can see on that link

Hope this will help you...

Lokesh Desai
  • 2,607
  • 16
  • 28