Bar


Bar


Android provides the options of different bars that can be used on an interface. One of the common bar is the progress bar, which shows the progress of an activity. It could be file download or file copy, or any other activity. The progress bar is shown as a spinning wheel, which is the default representation of the progress bar in Android. However, it can be shown as a horizontal bar as well. This can be done by setting the attribute as horizontal.

Image Not Found

The following code shows how to implement a horizontal progress bar.

A seekbar is a variant of the progress bar, where a draggable thumb is added to the conventional horizontal bar. The user can simply drag this thumb, either in left or right, to take to the desired position. This results in a change of the values that are associated with the component. A good example of this will be the volume control or the brightness control. It makes use of two specific properties, android:max and android:progress. On the other hand, ratingbar records the rating from the user. It is returned as a floating-point number. Key attributes of the rating bar are mentioned below.

  • Android:numStars:It will represent the number of stars that will be shown in the rating bar
  • Android:stepSizeThis resembles the step size of the rating.
  • Android:isIndicator:It indicates the total ratings, which are frozen and cannot be changed by the user.