0

I am trying to have a chronometer in HH:MM:SS format from XML in Android.

I have the following code but it doesn't work.

<Chronometer
        android:id="@+id/chronometer2"
        android:layout_width="117dp"
        android:layout_height="100dp"
        android:format="HH:MM:SS"
        tools:layout_editor_absoluteX="91dp"
        tools:layout_editor_absoluteY="316dp" />

How can I do? I want to set the format from XML and not from code. It is possible? I tried to set also the propriety "digits" to 6 but none happen. Can someone help me please!!

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
mekki10
  • 33
  • 1
  • 8
  • 1
    Don't know if it's a new Widget, if it is and you working with AppCompat you must use app:format instead of android:format. Also MM means month and SS is a special encoding for seconds, you should use HH:mm:ss – Marcos Vasconcelos Oct 31 '17 at 15:06
  • Possible duplicate of [Android Chronometer format](https://stackoverflow.com/questions/4897665/android-chronometer-format) – Marcos Vasconcelos Oct 31 '17 at 15:07
  • Sorry but if I use android:format="HH:mm:ss" doesn't work.. It display HH:mm:ss instead of 00:00:00 and when I start the chronometer it remain on HH:mm:ss. How can I do? thank you! – mekki10 Oct 31 '17 at 15:35
  • @mekki10 If this is still an open question I would like to refer to https://stackoverflow.com/questions/6437126/set-hhmmss-of-chronometer – MarBlo Jan 06 '18 at 07:00

0 Answers0