Reprint please indicate the source, thank you ~ ~
Many people ask this horizontal ProgressBar not ah, I can only say that certainly is not set to, below I paste my settings, for reference only.
<progressbar android:id=" @+ id/game_pro " android:layout_below=" @id /game_name " android:layout_width=" 100DP " android:layout_height=" 30DP " Android:layout_mar Gintop= "10DP" style= "android:attr/ Progressbarstylehorizontal " android:background=" @ Null " android:layout_centerhorizontal= android:progress Drawable= " @drawable /progress_bg" />
Ignore what ID ah, below ah something.
Width and height are set to ProgressBar the width of the height, which can be written to death, you write how big it is.
Style must be this, only set to this will be horizontal.
Background is set to null so there is no background to cover our background.
Then progressdrawable is the focus, look inside the specific code:
<layer-list xmlns:android="Http://schemas.android.com/apk/res/android" > <item android:id="@android: Id/background"> <shape> <corners Android:radius="2DP" /> <gradientandroid:angle="android:centercolor" = "@drawable/ Progress_back "android:centery=" 0.75 "android:endcolor=" @drawable/progress_ Back "android:startcolor=" @drawable/progress_back " /> </shape> </Item> <!--<item android:id= "@android: id/secondaryprogress" > <clip> <shape> <corners android:radius= "5dip"/> <gradient Android:startcolo R= "#80ffd300" android:centercolor= "#80ffb600" android:centery= "0.75" Android:endcolor= "#a0ffcb00" android:angle= "/>" </shape> </clip> </item> - <item android:id="@android: id/progress"> <clip> <shape> <corners Android:radius="2dip" /> <gradientandroid:angle="android:centercolor" = "@drawable/ Progress_forecolor "android:centery=" 0.75 "android:endcolor=" @ Drawable/progress_forecolor "android:startcolor=" @drawable/progress_forecolor " /> </shape> </clip> </Item></layer-list>
The first item we can see is android:id= "@android: Id/background", which is not progress when the background color, here is set to a gray 16 binary. Then the second item that is commented out is secondaryprogress, you know, some progress bar two color progress, that's it. The third item is progress, which is the color of the first progress bar we want to display. After this setting, there is no problem at all. Put a picture:
android--horizontal ProgressBar setting and implementation