Used in layout:
1 < Progressbar 2 Android: Id = "@ + ID/progress_bar" 3 Style = "? Android: ATTR/progressbarstylehorizontal "<! -- Must be set to horizontal --> 4 Android: progressdrawable = "@ drawable/myprogress" <! -- Use a custom style here --> 5 Android: layout_width = "158dp" 6 Android: layout_height = "5dp" 7 Android: layout_margintop = "5dp" 8 Android: maxheight = "5dp" 9 Android: minheight = "5dp" 10 Android: max = "100" 11 Android: secondaryprogress = "0" 12 Android: Progress = "0" 13 Android: indeterminateonly = "false"/>
The following is the XML source code myprogress. xml:
1 <? XML version = "1.0" encoding = "UTF-8"?> 2 <Layer-list xmlns: Android = "http://schemas.android.com/apk/res/android"> 3 <! -- The order of item background and progress cannot be reversed --> 4 <Item Android: Id = "@ Android: ID/background"> 5 <Shape Android: Shape = "line"> 6 < Stroke 7 Android: width = "4dp" Android: color = "#666666" <! -- Background color and width --> 8 Android: dashwidth = "4dp" Android: dashgap = "1dp"/> <! -- Dotted line interval 1dp --> 9 </Shape>10 </Item> 11 <Item Android: Id = "@ Android: ID/progress"> 12 <Clip> 13 <Shape Android: Shape = "line"> 14 < Stroke 15 Android: width = "4dp" Android: color = "#000000" 16 Android: dashwidth = "4dp" Android: dashgap = "1dp"/> 17 </Shape> 18 </Clip> 19 </Item> 20 </Layer-List>