title: How to set Android DatePicker mode to spinner for APIs below level 21
body: <p>I want to display a DatePickerDialog with mode spinner instead of calendar. In my styles.xml, I tried to put this attribute but it says that the minimum SDK version I should be using is API 21.</p>
  
  <pre><code>&lt;item name="android:datePickerMode"&gt;spinner&lt;/item&gt;
  </code></pre>
  
  <p>I am using minimum SDK version 18. How do I set the default date picker mode to spinner for APIs lower than API 21?</p>
  
  <p>This is my Java code for my date picker:</p>
  
  <pre><code>public class MyDatePicker extends DialogFragment implements DatePickerDialog.OnDateSetListener {
  
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
      DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), R.style.MyTheme, this, 0, 0, 0 );
      return datePickerDialog;
  }
  
  @Override
  public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks!</p>