【发布时间】:2017-11-01 20:27:41
【问题描述】:
我正在尝试在 Android Studio 上制作一种带有某些时区的时钟。
我放了一个 TextClock,在我的布局中这个 TextClock 出现 this way。
但是当我运行应用程序时,结果完全不同,like this。它返回一个完全不同的小时..
这是 TextClock 的 XML 代码:
<android.widget.TextClock
android:id="@+id/fuso"
android:layout_width="344dp"
android:layout_height="101dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:format12Hour="@null"
android:format24Hour="dd/MM/yyyy HH:mm:ss"
android:textSize="30sp"
android:timeZone="America/Los Angeles"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintVertical_bias="0.206" />
我能做什么?为什么我运行应用时android:timeZone="America/Los Angeles" 不起作用?
我需要添加一些东西吗?
谢谢。
【问题讨论】:
-
检查你的
android:format12Hour="@null" android:format24Hour="dd/MM/yyyy HH:mm:ss"两个标签 -
@JaydipUmaretiya 我试图删除 'android:format12Hour="@null" ' 但小时仍然不同
标签: java android android-studio timezone