相当简单加载 gradle文件然后做一个textview即可。
1.首先我们要在build.gradle中写上这一行代码:
compile 'com.feezu.liuli:timeselector:+'
public class MainActivity extends AppCompatActivity { private TextView t_time; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); initData(); } private void initData() { t_time.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm"); String format1 = format.format(date); TimeSelector timeSelector = new TimeSelector(MainActivity.this, new TimeSelector.ResultHandler() { @Override public void handle(String time) { t_time.setText(time); } }, format1, "2050-1-1 24:00"); timeSelector.show(); } }); } private void init() { t_time = (TextView) findViewById(R.id.t_time); } }