使用 DatePickerDialogManager 作为 日期 和 时间 的选择器
appcore_style=0
appcore_style=1
1. 使用
<me.luzhuo.lib_core.ui.widget.YearMonthDayView
android:id="@+id/ymd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:core_style="1"
app:core_mode="year|month|day|hour|minute|second" />
public class MainActivity extends AppCompatActivity {
private static final String TAG = MainActivity.class.getSimpleName();
private YearMonthDayView yearView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
yearView = findViewById(R.id.ymd);
//yearView.setMode(YearMonthDayView.Mode_Year|YearMonthDayView.Mode_Month|YearMonthDayView.Mode_Day|YearMonthDayView.Mode_Hour|YearMonthDayView.Mode_Minute);
yearView.setDateChangeCallback(new YearMonthDayView.OnDateChangeCallback() {
@Override
public void onDatePicker(int year, int month, int day) {
Log.e(TAG, "" + year + " : " + month + " : " + day);
}
@Override
public void onTimePicker(int hour, int minute) {
Log.e(TAG, "" + hour + " : " + minute);
}
});
}
public void onclick(View view) {
Log.e(TAG, "" + yearView.year());
Log.e(TAG, "" + yearView.month());
Log.e(TAG, "" + yearView.day());
Log.e(TAG, "" + yearView.hour());
Log.e(TAG, "" + yearView.minute());
Log.e(TAG, "" + yearView.second());
Log.e(TAG, "" + yearView.time());
}
}