Git Product home page Git Product logo

selectdateandtime's Introduction

SelectDateAndTime

这是一款自定义日期时间选择器 请注意 将WheelMain里面的以下代码

wv_mins.setAdapter(adapter); wv_mins.setCyclic(true);// 可循环滚动 wv_mins.setLabel(“分”);// 添加文字 int min = setMinute(m); wv_mins.setCurrentItem(min); 更换为 wv_mins.setAdapter(new NumericWheelAdapter( 0, 59)); wv_mins.setCyclic(true);// 可循环滚动 wv_mins.setLabel(“分”);// 添加文字 wv_mins.setCurrentItem(m); 还需要将 int minute = Integer.valueOf(adapter.getItem(wv_mins.getCurrentItem())); 改为 int minute = wv_mins.getCurrentItem(); 会将分钟更改为从0到59

如果不想要时间只想要年月日的话只需要 if (hasSelectTime) { wv_hours.setVisibility(View.GONE); wv_mins.setVisibility(View.GONE); } else { wv_hours.setVisibility(View.GONE); wv_mins.setVisibility(View.GONE); wv_day.setVisibility(View.GONE); } 还需要将 MainActivty里的如下代码 wheelMainDate.initDateTimePicker(year, month, day, hours,minute); 更改为 wheelMainDate.initDateTimePicker(year, month, day); 还有 wheelMain里的 if (!hasSelectTime) {

    sb.append((wv_year.getCurrentItem() + START_YEAR)).append("-")
            .append(strMon).append("-")
            .append(strDay).append("  ").append(strHour).append(":").append(strMin);
}else{
    sb.append((wv_year.getCurrentItem() + START_YEAR)).append("-")
            .append(strMon).append("-")
            .append(strDay).append("  ").append(strHour).append(":").append(strMin);
}

需要修改为 if (!hasSelectTime) {

    sb.append((wv_year.getCurrentItem() + START_YEAR)).append("-")
            .append(strMon).append("-")
            .append(strDay);
}else{
    sb.append((wv_year.getCurrentItem() + START_YEAR)).append("-")
            .append(strMon).append("-")
            .append(strDay);
}

注意还要删除布局文件里面的关于部分垂直虚线    具体的请看csdn博客:http://blog.csdn.net/u014452224/article/details/52461734

selectdateandtime's People

Contributors

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