【发布时间】:2020-03-05 11:18:03
【问题描述】:
如何从我制作的 XMl android 中进行倒计时'HH: mm: ss',如果在 24 小时内没有交互则无法再次进行交易或无法再次访问
这段代码是倒计时的设计UI。
倒数计时器
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constrainlayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="18dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/bg_color_orange"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_bar">
<TextView
android:id="@+id/textView_Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:text="Please make a payment Immediatelly"
android:textColor="@android:color/black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/constrainlayout" />
<TextView
android:id="@+id/textView_TimeCountDown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:text="13 Hour: 59 Minute: 21 Second"
android:textColor="@android:color/black"
android:textSize="22sp"
app:layout_constraintEnd_toEndOf="@+id/textView_Title"
app:layout_constraintStart_toStartOf="@+id/textView_Title"
app:layout_constraintTop_toBottomOf="@+id/textView_Title" />
<TextView
android:id="@+id/textView_Day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:layout_marginBottom="18dp"
android:text="(Before Thursday, 16 January 2020, 13:33 WIB)"
android:textColor="@android:color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/textView_Title"
app:layout_constraintStart_toStartOf="@+id/textView_Title"
app:layout_constraintTop_toBottomOf="@id/textView_TimeCountDown" />
</androidx.constraintlayout.widget.ConstraintLayout>
该代码将像这样显示
【问题讨论】:
标签: java android kotlin countdown countdowntimer