How to create circular progress bar(pie chart) like indicator - Android

前端 未结 5 2011
北恋
北恋 2020-12-08 08:05

Now I have a horizontal progress bar which is updated programmatically via ProgressBar setProgress method:



        
5条回答
  •  隐瞒了意图╮
    2020-12-08 08:49

    For a circular progress bar, use:

    style="?android:attr/progressBarStyle"
    

    More details can be found here: What's the meaning of android:progressBarStyle attribute in ProgressBar?

    As for setting its progress: the circular progress bar will keep spinning. Simply hide it after it's no longer needed.

    Or you could implement something custom: show a TextView next to it and update it instead of using Progressbar.setProgress.

    Step 0: setText("0%");
    Step 1 (2 seconds later): setText("3%");
    Step 2 (4 seconds later): setText("9%"); etc.
    

提交回复
热议问题