DatePicker隐藏年月日显示

以前一直都是用系统提供的日期选择控件,然后开发项目需要需要隐藏年月日等不同的组合。然后就从网上找了些Demo用,项目完成之后测试人员选择系统不同的年月日显示方式引起年月日显示的错位,卧槽!后来随之了解5.0以下的和以上的执行方式也不一样 ,只得改了,改完赶紧记录一下。

TimeDialog

public class TimeDialog extends Dialog {

    private DatePicker datePicker;
    private int type = 3;  //1表示只显示年; 2表示显示年月 ;3表示显示年月日

    //设置监听 时间
    public interface myTimeListener{
        public void timeListener(String time) ;
    };

    public myTimeListener iTimeListener = null ;

    public void setTimeListener(myTimeListener listener)
    {
        iTimeListener = listener;
    }

    /*
    1表示只显示年; 2表示显示年月 ;3表示显示年月日
     */
    public TimeDialog(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
        setContentView(R.layout.time_dialog);
        initView();

    }

    /*
    1表示只显示年; 2表示显示年月 ;3表示显示年月日
     */
    public TimeDialog(Context context, int theme, int type) {
        super(context, theme)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值