Update TextView Every Second

前端 未结 9 1297
南旧
南旧 2020-11-28 23:58

I\'ve looked around and nothing seems to be working from what I\'ve tried so far...

    @Override
protected void onCreate(Bundle savedInstanceState) {
    su         


        
9条回答
  •  情歌与酒
    2020-11-29 00:15

    It's a very old question and I'm sure there are a lot of resources out there. But it's never too much to spread the word to be at the safe side. Currently, if someone else ever want to achieve what the OP asked, you can use: android.widget.TextClock.

    TextClock documentation here.

    Here's what I've used:

    
        android:format24Hour="dd MMM yyyy   k:mm:ss"
        android:format12Hour="@null"
        android:textStyle="bold"
        android:layout_alignParentEnd="true" />
    

提交回复
热议问题