使用 DatePickerDialogManager 作为 日期 和 时间 的选择器

appcore_style=0
appcore_style=0.png
appcore_style=1
appcore_style=1.png

1. 使用

  1. <me.luzhuo.lib_core.ui.widget.YearMonthDayView
  2. android:id="@+id/ymd"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content"
  5. app:core_style="1"
  6. app:core_mode="year|month|day|hour|minute|second" />
  1. public class MainActivity extends AppCompatActivity {
  2. private static final String TAG = MainActivity.class.getSimpleName();
  3. private YearMonthDayView yearView;
  4. @Override
  5. protected void onCreate(Bundle savedInstanceState) {
  6. super.onCreate(savedInstanceState);
  7. setContentView(R.layout.activity_main);
  8. yearView = findViewById(R.id.ymd);
  9. //yearView.setMode(YearMonthDayView.Mode_Year|YearMonthDayView.Mode_Month|YearMonthDayView.Mode_Day|YearMonthDayView.Mode_Hour|YearMonthDayView.Mode_Minute);
  10. yearView.setDateChangeCallback(new YearMonthDayView.OnDateChangeCallback() {
  11. @Override
  12. public void onDatePicker(int year, int month, int day) {
  13. Log.e(TAG, "" + year + " : " + month + " : " + day);
  14. }
  15. @Override
  16. public void onTimePicker(int hour, int minute) {
  17. Log.e(TAG, "" + hour + " : " + minute);
  18. }
  19. });
  20. }
  21. public void onclick(View view) {
  22. Log.e(TAG, "" + yearView.year());
  23. Log.e(TAG, "" + yearView.month());
  24. Log.e(TAG, "" + yearView.day());
  25. Log.e(TAG, "" + yearView.hour());
  26. Log.e(TAG, "" + yearView.minute());
  27. Log.e(TAG, "" + yearView.second());
  28. Log.e(TAG, "" + yearView.time());
  29. }
  30. }