Git Product home page Git Product logo

datetimepicker's Introduction

Material DatePicker and TimePicker dialogs from the Android framework package

This project is ported from the Android framework. In order to make the pickers material themed on older devices (pre-Lollipop), the appcompat library is used for base theming and vector drawable handling. The widgets always use the custom layouts, this is a complete replacement for the framework pickers. This also means that they have the same look-and-feel on all API levels.

Download

Donation

If you would like to support me, you may donate some small amount via PayPal.

Buy me a coffee


Setup

Add this single line to your gradle file:

compile 'com.takisoft.fix:datetimepicker:1.0.6'

And use one of the Theme.AppCompat themes (or a custom one based on that) as your Activity's theme.

Now you can use the following material themed picker dialogs:

  • DatePickerDialog (from com.takisoft.datetimepicker.DatePickerDialog)
  • TimePickerDialog (from com.takisoft.datetimepicker.TimePickerDialog)

Additionally you could technically use DatePicker and TimePicker from the com.takisoft.datetimepicker.widget package inside a layout as an inline view, however, they do not support scrolling containers, so it's recommended to stick with the dialogs instead.


Customization

You can override the following attributes in your theme (check out the default styles for details):

Attribute Description Default (dark) / (light)
datePickerStyle The DatePicker's style Widget.Material.DatePicker / Widget.Material.Light.DatePicker
datePickerDialogTheme The DatePickerDialog's style ThemeOverlay.Material.Dialog.DatePicker
timePickerStyle The TimePicker's style Widget.Material.TimePicker / Widget.Material.Light.TimePicker
timePickerDialogTheme The TimePickerDialog's style ThemeOverlay.Material.Dialog.TimePicker
numberPickerStyle The NumberPicker's style which is going to be used if there's not enough room on the screen for the normal pickers Widget.Material.NumberPicker / Widget.Material.Light.NumberPicker
calendarViewStyle The CalendarView's style Widget.Material.CalendarView / Widget.Material.Light.CalendarView

Watch out not to include the android: prefix before the attribute names if you want to override them as it will not work. These attributes have been (re)defined for the project in order to be able to access the internal details, which means that they do not belong to the android namespace anymore.

Some pictures

API 15 API 26
DatePicker DatePicker
DatePicker DatePicker
DatePicker DatePicker
DatePicker DatePicker

You can see that in landscape the API 15 images show spinners instead of a calendar view. This is because there is not enough room for the calendar, so the spinners are used as fallback.

datetimepicker's People

Contributors

gregkorossy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.