캘린더보기에서 단일 날짜를 선택하기위한 독립형 안드로이드 위젯.
레이아웃 XML에 CalendarPickerView
포함시킵니다.
< com .squareup.timessquare.CalendarPickerView
android : id = " @+id/calendar_view "
android : layout_width = " match_parent "
android : layout_height = " match_parent "
/>
이것은 상당히 큰 제어이므로 레이아웃에 충분한 공간을 제공하는 것이 현명합니다. 소규모 장치에서는 대화 상자, 전체 화면 조각 또는 전용 활동을 사용하는 것이 좋습니다. 태블릿과 같은 더 큰 장치에서는 전체 화면을 표시하는 것이 권장되지 않습니다. 레이아웃이나 대화 상자의 일부를 차지하는 조각이 더 나은 선택입니다.
활동/대화 또는 조각의 onCreateView
onCreate
때 다양한 유효한 날짜와 현재 선택된 날짜로보기를 초기화하십시오.
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 '
개발 버전의 스냅 샷은 Sonatype의 snapshots
저장소에서 사용할 수 있습니다.
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.