Android uses ProgressBar to achieve percent display

Source: Internet
Author: User

Show horizontal progress bar I think of two kinds: Seekbar and ProgressBar, both of which can show progress, the most obvious difference is that Seekbar can be dragged by hand, for example, the user can control the sound effects in the application, control the progress of music playback, and so on, You can use drag bars to implement

A progress bar that needs to implement a percentage of voting:

ProgressBar layout:

Where background refers to the background of the progress bar background is gray

Some properties of ProgressBar are in the style

<style name= "Styleprogressbar" parent= "@android: Style/widget.progressbar.horizontal" >
<item name= "Android:maxheight" >50dip</item>
<item name= "Android:minheight" >10dip</item>
<item name= "Android:indeterminateonly" >false</item>
<item name= "android:indeterminatedrawable" > @android:d Rawable/progress_indeterminate_horizontal</item >
<item name= "android:progressdrawable" > @drawable/salondetail_progress_drawable</item>
</style>

Where progressdrawable is the green progress of the custom progress bar

Id:backgroud is the bottom gray background of the progress bar

: Id/secondaryprogress is the green on the progress bar

Set Android:max = "100" for easy calculation of percentages




Android uses ProgressBar to achieve percent display

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.