app:core_style=”0” (默认)
app:core_style=”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"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
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());
}
}