Show milliseconds with Android Chronometer

前端 未结 5 524
深忆病人
深忆病人 2021-01-01 18:44

I\'m looking for a way to make the Chronometer in Android (preferably 1.6 and upwards) show 10ths of a second while counting up.

Is it possible to do this? If not, i

5条回答
  •  遥遥无期
    2021-01-01 19:00

    Is it possible to do this?

    Not really. You could pass a format string that shows tenths of a second, but the Chronometer itself only updates every second. The update frequency is baked into the code.

    If not, is there a free (and preferably open source) library that does the same?

    The Chronometer source is available under the Apache License 2.0, so you can modify it to suit. Find all occurrences of 1000 and change them to 100, and you're probably most of the way there.

    Bear in mind that this Chronometer can be used in an activity but not an app widget, since customized View classes are not supported by the app widget framework.

提交回复
热议问题