Sie sind auf Seite 1von 6

SpinnerDatePicker (/details/1/6319)

 131 (https://github.com/drawers/SpinnerDatePicker/stargazers?utm_source=android-

arsenal.com&utm_medium=referral&utm_campaign=6319) 6

(https://github.com/drawers/SpinnerDatePicker/watchers?utm_source=android-

arsenal.com&utm_medium=referral&utm_campaign=6319)  50

(https://github.com/drawers/SpinnerDatePicker/network?utm_source=android-

arsenal.com&utm_medium=referral&utm_campaign=6319)  7

(https://github.com/drawers/SpinnerDatePicker/issues?utm_source=android-

arsenal.com&utm_medium=referral&utm_campaign=6319)

 (https://facebook.com/sharer.php?
General u=https://android-
Category
arsenal.com/details/1/6319)
Free (/free)

Tag
 (https://twitter.com/intent/twe
arsenal.com/details/1/6319&text=The%20An
Date & Time Pickers (/tag/27)

License %20Date%20%26%20
%20SpinnerDatePicker
Apache License, Version 2.0 (http://opensource.org/licenses/Apache-2.0?utm_source=android-arsenal.co
m&utm_medium=referral&utm_campaign=6319)

 (http://news.ycombinator.com/submitlink
Min SDK
18 (Android 4.3 Jelly Bean) (/api?level=18)
arsenal.com/details/1/6319&t=The%20Andro
Registered
Oct 14, 2017 %20Date%20%26%20Tim
Favorites %20
3

Link
https://github.com/drawers/SpinnerDatePicker (https://github.com/drawers/SpinnerDatePicker?utm_sourc
e=android-arsenal.com&utm_medium=referral&utm_campaign=6319)

See also
TimePicker (/details/1/1610)
Material Calendar View (/details/1/2715)
SlideDateTimePicker (/details/1/1503)
 (https://plus.google.com/share?
Android-RecurrencePicker (/details/1/120)

url=https://android-
Material Weekdays Buttons Bar (/details/1/2822)

Additional arsenal.com/details/1/6319)
Language
Java
 (https://reddit.com/subm
arsenal.com/details/1/6319&title=The%20An
Version
%20Date%20%26%20
N/A (https://github.com/drawers/SpinnerDatePicker/releases?utm_source=android-arsenal.com&utm_me

%
dium=referral&utm_campaign=6319)

Created
Aug 29, 2017

Updated
Aug 21, 2018

Owner
David Rawson (drawers) (/user/drawers)

Contributors
6 (https://github.com/drawers/SpinnerDatePicker/graphs/contributors?utm_source=android-arsenal.com&
utm_medium=referral&utm_campaign=6319)

Activity

Badge
 Generate

Download
 Source code

Announcement
  

Machine Learning powered


Personalized programming search
analyzes results to match
Code Search your dev pro le.

API 16+ (https://android-arsenal.com/api?level=18) Android Arsenal SpinnerDatePicker


(https://android-arsenal.com/details/1/6319) JitPack 1.0.6
(https://jitpack.io/#drawers/SpinnerDatePicker)

Spinner DatePicker

Summary

The old "spinner" style DatePicker for newer devices.

(https://camo.githubusercontent.com/6a89b44f1fe60067f68f37dcacff46cea335947d/68747470733
a2f2f692e696d6775722e636f6d2f544d69697656712e706e67?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=6319)

Motivation

The default Material Design DatePicker has poor usability for choosing a date of birth. It seems it is
hard for users to find the "year" button and they will often simply swipe left or right through the
months in order to find their date of birth.

(https://camo.githubusercontent.com/26db2495313d82b10cca104d57fdf7b41c0720ff/6874747073
3a2f2f692e696d6775722e636f6d2f386c6d5a6862642e706e673f31?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=6319)

The previous Holo DatePicker with sliding NumberPickers is much more suitable for this use case
however it is no longer available for Marshmallow devices and up.

This library is heavily based on the latest Android Open Source Project
(https://source.android.com/?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=6319) DatePicker (source code here
(http://androidxref.com/8.0.0_r4/xref/frameworks/base/core/java/android/widget/DatePickerSpinner
Delegate.java?utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=6319))
with the addition of being able to style the NumberPickers (the dials/spinners in the DatePicker).

Adding styles

The DatePicker is the simple aggregation of three NumberPickers. You can style the DatePicker
easily with a NumberPicker style (in styles.xml in the values folder):

<style name="NumberPickerStyle">
<item name="android:textSize">22dp</item>
<item name="android:textColorPrimary">@color/colorAccent</item>
<item name="android:colorControlNormal" tools:targetApi="lollipop">@color/colorAccent</
</style>
where colorControlNormal is the color of the horizontal bars (dividers) in the NumberPicker . See
this StackOverflow question (https://stackoverflow.com/q/20148671/5241933?
utm_source=android-arsenal.com&utm_medium=referral&utm_campaign=6319)

And then:

new SpinnerDatePickerDialogBuilder()
.context(MainActivity.this)
.callback(MainActivity.this)
.spinnerTheme(R.style.NumberPickerStyle)
.showTitle(true)
.showDaySpinner(true)
.defaultDate(2017, 0, 1)
.maxDate(2020, 0, 1)
.minDate(2000, 0, 1)
.build()
.show();

The example project should make it clear - get it by cloning the repo.

Note that full support is only for API >= 18. API < 18 you'll get the DatePicker but there is no easy
way to style it correctly.

Usage in a project

Add the following to your project level build.gradle :

allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}

Add this to your app level build.gradle :

dependencies {
compile 'com.github.drawers:SpinnerDatePicker:1.0.6'
}

Philosophy

The aim of this project is to produce a lightweight and robust DatePicker with an API similar to that
of the standard Android DatePicker. Hence the library has no external dependencies and no fancy
features. Espresso automated UI testing is performed on the sample project using Firebase test
lab.

Contributing
Please open an issue first before making a pull request. Pull requests should be accompanied by
tests if possible.

License

Copyright 2017 AOSP, David Rawson

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions and
limitations under the License.

FBS tiene a lot of Apples OPEN


A lot of Apples de FBS, especialmente para los traders más activos! esfbs.com

Follow us on Twitter (https://twitter.com/Android_Arsenal?utm_source=android-


arsenal.com&utm_medium=referral&utm_campaign=6319)

Read us in Telegram (https://telegram.me/AndroidArsenal?utm_source=android-


arsenal.com&utm_medium=referral&utm_campaign=6319)

Get Android app on Google Play (https://play.google.com/store/apps/details?


id=com.android_arsenal.androidarsenal&utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=6319)

Stay informed with Pushbullet (https://www.pushbullet.com/channel?tag=android_arsenal&utm_source=android-


arsenal.com&utm_medium=referral&utm_campaign=6319)

Created by Vladislav Bauer (https://github.com/vbauer?utm_source=android-


arsenal.com&utm_medium=referral&utm_campaign=6319)
 (https://twitter.com/BauerVlad?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=6319)
 (https://www.linkedin.com/in/vladislavbauer?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=6319)
 (https://www.paypal.me/VladislavBauer?utm_source=android-
arsenal.com&utm_medium=referral&utm_campaign=6319)
© 2014-2018 - Android Arsenal (/) | Privacy (/privacy)

Das könnte Ihnen auch gefallen