在DatePicker中显示月份名称

时间:2013-12-09 12:09:37

标签: android

在我的应用中,我使用DatePicker的日历视图,但它不显示当前月份的名称。我认为这对用户来说不是很方便。有没有办法显示月份名称?

2 个答案:

答案 0 :(得分:2)

尝试这样的事情

public static final String[] MONTHS = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
String mon=MONTHS[monthNumber];

并使用mon

答案 1 :(得分:2)

您可以这样做:

DatePicker datepicker=new DatePicker();
int month=date.getMonth();
public static final String[] MONTHS = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
String mon=MONTHS[month];

希望这有帮助!