Git Product home page Git Product logo

datepicker's Introduction

DatePicker

A Holo-style date selection widget can be used in API level 4+. It provides some APIs for you to modify font size, font color, background color, lines of the numbers and sound effect.

一个Holo风格的日期选择组件。原生的DatePicker没有提供修改样式的Api,只能通过主题来修改,不够灵活,而且只能在sdk版本14以上才能使用。这里基于android.view.View重写了一下,兼容到sdk版本4以上,同时支持自定义字体和背景颜色、字体大小、中文模式右上角角标文字样式、显示的行数、英文显示以及滚动日期的音效。

ScreenShots

How to use

Gradle

Step 1. Add it in your root build.gradle at the end of repositories:

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

Step 2. Add the dependency

dependencies {
    compile 'com.github.chenglei1986:DatePicker:-SNAPSHOT'
    compile 'com.github.luhaoaimama1:DatePicker:1.0'//我的
}

Maven

<repositories>
	<repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
	</repository>
</repositories>
<dependency>
    <groupId>com.github.chenglei1986</groupId>
    <artifactId>DatePicker</artifactId>
    <version>-SNAPSHOT</version>
</dependency>

In your Activity

Sound sound1 = new Sound(this);
mDatePicker1.setSoundEffect(sound1)
	.setTextColor(Color.RED)
	.setFlagTextColor(Color.RED)
	.setTextSize(25)
	.setFlagTextSize(15)
	.setSoundEffectsEnabled(true);
Sound sound2 = new Sound(this);
sound2.setCustomSound(R.raw.beep);
mDatePicker2.setSoundEffect(sound2)
	.setTextColor(Color.WHITE)
	.setFlagTextColor(Color.WHITE)
	.setTextSize(25)
	.setFlagTextSize(15)
	.setBackground(Color.BLACK)
	.setSoundEffectsEnabled(true);
mDatePicker3.setTextColor(Color.BLACK)
	.setFlagTextColor(Color.BLACK)
	.setBackground(Color.RED)
	.setTextSize(25)
	.setFlagTextSize(15)
	.setRowNumber(5)
	.setOnDateChangedListener(new DatePicker.OnDateChangedListener() {

		@Override
		public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
				Log.i("DatePicker", year + "-" + monthOfYear + "-" + dayOfMonth);
		}
	});

datepicker's People

Contributors

chenglei1986 avatar luhaoaimama1 avatar

Watchers

 avatar  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.