Android Studio中直接在 gradle中加入:
compile 'com.feezu.liuli:timeselector:1.0.8+'
package com.bawei.com.iosshijianlunxunqi; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.Toast; import org.feezu.liuli.timeselector.TimeSelector; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button but; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); } private void initView() { but = (Button) findViewById(R.id.but); but.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.but: TimeSelector timeSelector = new TimeSelector(this, new TimeSelector.ResultHandler() { @Override public void handle(String time) { //打印时间 Toast.makeText(getApplicationContext(), time, Toast.LENGTH_LONG).show(); } }, "2015-10-01 10:34", "2050-12-1 17:34","9:00","17:00");//起始时间 和结束时间 timeSelector.show(); break; } } }