DataPicker looks like old design on new API's as well

前端 未结 4 995
一整个雨季
一整个雨季 2021-01-12 11:16

So the problem is very simple:

I have integrated a DatePicker in my application. Not as a DialogDatePicker but as a View component (more pr

4条回答
  •  情话喂你
    2021-01-12 12:03

    Set your android:targetSdkVersion to be 11 or higher. Here is a sample application demonstrating this.


    UPDATE

    First, your original DatePicker screenshot is from a dark theme (e.g., Theme.Holo), whereas your second screenshot is from a light theme (e.g., Theme.Holo.Light).

    Second, the DatePicker documentation has the following opening paragraph:

    This class is a widget for selecting a date. The date can be selected by a year, month, and day spinners or a CalendarView. The set of spinners and the calendar view are automatically synchronized. The client can customize whether only the spinners, or only the calendar view, or both to be displayed. Also the minimal and maximal date from which dates to be selected can be customized.

    You can get rid of the CalendarView via android:calendarViewShown (or setCalendarViewShown()). When you try that, you will find that your year spinner will appear once the CalendarView is gone.

提交回复
热议问题