Search code examples
androidkotlinandroid-widget

TextClock is not working in the same format after changing Locale in Kotlin


I am using TextClock in hh:mm:ss a format to show current time. But when I change the locale from English to Spanish(es) TextClock gives time in wrong format i.e hh:mm. This is happening only in Samsung Tab.

<TextClock
                android:id="@+id/clockTimeTv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:fontFamily="@font/regular"
                android:text="12:58:18 PM"
                android:textColor="@color/dark_grey"
                android:textSize="@dimen/_18sdp"
                android:textStyle="bold"
                android:format12Hour="hh:mm:ss a"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"/>

Solution

  • i have tested on my samsung galaxy tab s2 and it is working fine on that..there must be issue with the specific device settings , just try changing language from settings and then check the time zone format may be