Android Application

Kotlin 고급 위젯 - 날짜와 시간 관련 위젯 : 타임피커(TimePicker)와 데이트피커(DatePicker)

작성자 임베디드코리아 작성일23-09-24 00:26 조회1,579회 댓글0건

첨부파일

------------------------------------------------------------------------------------
      activity_main.xml
-------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TimePicker
        android:id="@+id/timePicker"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="71dp"
        android:timePickerMode="spinner"
        app:layout_constraintBottom_toTopOf="@+id/datePicker" />


    <DatePicker
        android:id="@+id/datePicker"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="71dp"
        android:datePickerMode="spinner"
        app:layout_constraintTop_toBottomOf="@+id/timePicker"
        tools:layout_editor_absoluteX="41dp" />

</androidx.constraintlayout.widget.ConstraintLayout>