Android日历只显示年月,只显示年
public class YearPickerDialog extends DatePickerDialog {
public YearPickerDialog(Context context, OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth) {
super(context, callBack, year, monthOfYear, dayOfMonth);
// this.setTitle(year + “年” + (monthOfYear + 1) + “月”);
// ((ViewGroup) ((ViewGroup) //this.getDatePicker().getChildAt(0)).getChildAt(0)).getChildAt(1).setVisibility(View.GONE);
((ViewGroup) ((ViewGroup) this.getDatePicker().getChildAt(0)).getChildAt(0)).getChildAt(2).setVisibility(View.GONE);
} public YearPickerDialog(Context context, int theme, OnDateSetListener listener, int year, int monthOfYear, int dayOfMonth) { super(context, theme, listener, year, monthOfYear, dayOfMonth);
// this.setTitle(year + “年” + (monthOfYear + 1) + “月”);
// ((ViewGroup) ((ViewGroup) //this.getDatePicker().getChildAt(0)).getChildAt(0)).getChildAt(1).setVisibility(View.GONE);
((ViewGroup) ((ViewGroup) this.getDatePicker().getChildAt(0)).getChildAt(0)).getChildAt(2).setVisibility(View.GONE);
}
@Override public void onDateChanged(DatePicker view, int year, int month, int day) { super.onDateChanged(view, year, month, day); this.setTitle(year + "年" ); }
}
————————————————
版权声明:本文为CSDN博主「Eric_Bang」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://www.geek-share.com/detail/2671384043.html
- Android日历选择控件DatePickerDialog只显示年月
- Android日历只显示年月,只显示年
- android实现双日期选择控件(可隐藏日,只显示年月)
- android launcher 日历图标显示日期
- Android日历开发:日历显示需要准备哪些数据
- Android DatePickerDialog 只显示年月
- Android DatePickerDialog 只显示年月
- Android DatePickerDialog 只显示年月
- Android定制日历,支持周月切换,日期标记,农历显示,节假日
- Android 原生Launcher2中动态刷新日历图标 显示日期与星期
- android自定义view显示日历
- Android 编程笔记 只显示年月的时间选择器对话框
- android launcher 日历icon显示日期
- android 日历图标显示星期
- android launcher 日历icon显示星期
- android开发笔记--时间控件只显示年月不显示日期【如有需要可以更为只显示月日不显示年份】
- Android DatePickerDialog 只显示年月
- android中DatePickerDialog只显示年月
- android 修改DatePickerDialog只显示“年月”,去掉“日”显示