Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

没有年月的选择 #5

Open
faelssim opened this issue Aug 4, 2017 · 2 comments
Open

没有年月的选择 #5

faelssim opened this issue Aug 4, 2017 · 2 comments

Comments

@faelssim
Copy link

faelssim commented Aug 4, 2017

能否加个年月的type

@aking86
Copy link

aking86 commented May 17, 2018

可以自己加, "yyyy-MM"

@xiaominglei001
Copy link

目前想到的办法,首先枚举增加一个类型
public enum DateType {

TYPE_ALL("yyyy-MM-dd E hh:mm"),//年、月、日、星期、时、分
TYPE_YMDHM("yyyy-MM-dd hh:mm"),//年、月、日、时、分
TYPE_YMDH("yyyy-MM-dd hh"),//年、月、日、时
TYPE_YMD("yyyy-MM-dd"),//年、月、日
TYPE_YM("yyyy-MM"),//年月
TYPE_HM("hh:mm");//时、分
private String format;

DateType(String format) {
this.format = format;
}

public String getFormat() {
return format;
}
}

然后DatePicker.java中也要适用这个类型
case TYPE_YM:
this.minuteView.setVisibility(GONE);
this.hourView.setVisibility(GONE);
this.weekView.setVisibility(GONE);
this.dayView.setVisibility(GONE);
this.monthView.setVisibility(VISIBLE);
this.yearView.setVisibility(VISIBLE);
break;

然后就有了年月的选项了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants