عنصر واجهة مستقلة Android المستقلة لاختيار تاريخ واحد من عرض تقويم.
قم بتضمين CalendarPickerView
في تخطيط XML الخاص بك.
< com .squareup.timessquare.CalendarPickerView
android : id = " @+id/calendar_view "
android : layout_width = " match_parent "
android : layout_height = " match_parent "
/>
هذا عنصر تحكم كبير إلى حد ما ، لذا من الحكمة أن يمنحها مساحة كبيرة في تخطيطك. على الأجهزة الصغيرة ، يوصى باستخدام مربع حوار أو جزء كامل الشاشة أو نشاط مخصص. على أجهزة أكبر مثل الأجهزة اللوحية ، لا ينصح بعرض الشاشة كامتلال. يعد جزءًا من جزء من التخطيط أو مربع الحوار خيارًا أفضل.
في onCreate
من نشاطك/مربع الحوار أو onCreateView
لشظبك ، قم بتهيئة العرض بمجموعة من التواريخ الصالحة وكذلك التاريخ المحدد حاليًا.
Calendar nextYear = Calendar . getInstance ();
nextYear . add ( Calendar . YEAR , 1 );
CalendarPickerView calendar = ( CalendarPickerView ) findViewById ( R . id . calendar_view );
Date today = new Date ();
calendar . init ( today , nextYear . getTime ())
. withSelectedDate ( today );
الوضع الافتراضي للعرض هو أن يكون لديك تاريخ واحد يمكن اختياره. إذا كنت تريد أن يتمكن المستخدم من تحديد تواريخ متعددة أو نطاق تاريخ ، فاستخدم طريقة inmode ():
calendar . init ( today , nextYear . getTime ())
. inMode ( RANGE );
يمكن تنزيل أحدث إصدار في ZIP والإشارة إليه من قبل تطبيقك كمشروع مكتبة.
يمكنك أيضًا الاعتماد على المكتبة من خلال Maven:
< dependency >
< groupId >com.squareup</ groupId >
< artifactId >android-times-square</ artifactId >
< version >1.6.5</ version >
< type >apklib</ type >
</ dependency >
أو Gradle:
compile ' com.squareup:android-times-square:1.6.5@aar '
تتوفر لقطات من إصدار التطوير في مستودع snapshots
Sonatype.
Copyright 2012 Square, Inc.
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.