First, let's look at the style definition for the progress bar under the framework, as follows
<stylename= "Widget.progressbar"> <Itemname= "Android:indeterminateonly">True</Item> <Itemname= "Android:indeterminatedrawable">@android:d Rawable/progress_medium_white</Item> <Itemname= "Android:indeterminatebehavior">Repeat</Item> <Itemname= "Android:indeterminateduration">3500</Item> <Itemname= "Android:minwidth">48dip</Item> <Itemname= "Android:maxwidth">48dip</Item> <Itemname= "Android:minheight">48dip</Item> <Itemname= "Android:maxheight">48dip</Item> <Itemname= "Android:mirrorforrtl">False</Item>
For the above attribute, the meaning is as follows
| Property name |
Describe |
| Android:animationresolution |
The milliseconds between the time-out animation frames, which must be an integer value, such as "100". |
| Android:indeterminate |
Whether to allow the use of indeterminate mode, in the indeterminate mode, the progress bar animation Infinite loop |
| Android:indeterminatebehavior |
Define the performance of the indeterminate pattern when the progress is maximized; The value must be repeat or cycle,repeat to indicate that the progress is starting from 0, and that cycle indicates that the progress remains current and goes back to 0 |
| Android:indeterminatedrawable |
Defines whether the indeterminate mode can be pulled |
| Android:indeterminateduration |
Time-Varying animations |
| Android:indeterminateonly |
Limit to indeterminate mode |
| Android:interpolator |
|
| Android:max |
Define the maximum value of the progress |
| Android:maxheight |
Maximum Progress widget height |
| Android:miniheight |
Progress widget min. high |
| Android:maxwidth |
Maximum Progress widget width |
| Android:minwidth |
Progress widget min. width |
| Android:mirrorforrtl |
Defines the relevant artboard if needed to be reflected in RTL mode |
| Android:progress |
Set the default value for progress from 0 to Max |
| Android:progressdrawable |
|
| Android:secondaryprogress |
Defines a level two progress value ranging from 0 to max. The progress is between the master progress and the background. For example, for network playback video, level two progress is used to represent the buffering progress, and the master progress is used to indicate the playback progress. |
Let's see what's the difference between the MaxHeight property and the Layout_height in ProgressBar.
The code is as follows
<ProgressBarAndroid:id= "@+id/stateprogressbar"android:orientation= "Horizontal"Android:layout_width= "Match_parent"Android:layout_height= "200DP"Android:max= "+"android:progress= "Ten"Android:background= "#00ffff"android:secondaryprogress= " the"Android:layout_margintop= "4dip"style= "@style/play_progressbar"/>
The code for style is as follows
<stylename= "Play_progressbar"Parent= "@android: Style/widget.holo.light.progressbar.horizontal"> <Itemname= "Android:progressdrawable">@drawable/progress_horizontal_holo_dark</Item> <Itemname= "Android:minheight">50dp</Item> <Itemname= "Android:maxheight">50dp</Item> <!--Item Name= "android:indeterminatedrawable" > @drawable/progress_indeterminate_horizontal_holo</item - </style>
Run results
We can see that Layout_height has a role, and that the progress bar is filled with the entire ProgressBar
When Max is bigger than PROGRESSBA,
<ProgressBarAndroid:id= "@+id/stateprogressbar"android:orientation= "Horizontal"Android:layout_width= "Match_parent"Android:layout_height= "50DP"Android:max= "+"android:progress= "Ten"Android:background= "#00ffff"android:secondaryprogress= " the"Android:layout_margintop= "4dip"style= "@style/play_progressbar"/>
Style
<stylename= "Play_progressbar"Parent= "@android: Style/widget.holo.light.progressbar.horizontal"> <Itemname= "Android:progressdrawable">@drawable/progress_horizontal_holo_dark</Item> <Itemname= "Android:minheight">200dp</Item> <Itemname= "Android:maxheight">200dp</Item> <!--Item Name= "android:indeterminatedrawable" > @drawable/progress_indeterminate_horizontal_holo</item - </style>
Run results
Proves again that the correctness of the above statement
Progressbar-style attribute Analysis