Reputation: 6090
I'm following the Big Nerd Ranch Android Programming book right now. I'm currently trying to get a DatePicker fragment to display as spinners. It seems to continually display a calender view and I can't figure out why. Any ideas what I'm doing wrong?
layout:
<?xml version="1.0" encoding="utf-8"?>
<DatePicker
android:id="@+id/dialog_date_datePicker"
android:spinnersShown="true"
android:calendarViewShown="false"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</DatePicker>
How I'm creating it:
public class DatePickerFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View v = getActivity().getLayoutInflater()
.inflate(R.layout.dialog_date, null);
return new AlertDialog.Builder(getActivity())
.setView(v)
.setTitle(R.string.date_picker_title)
.setPositiveButton(android.R.string.ok, null)
.create();
}
}
Upvotes: 2
Views: 1824
Reputation: 3578
Try adding this:
android:datePickerMode="spinner"
along with:
android:calendarViewShown="false"
Upvotes: 5