[英]Android progress bar fill
I want a loading bar in a circle shape. 我想要一个圆形的加载条。 I want to fill it with an integer i tried this
我想用一个整数填充它我试过这个
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminateDrawable="@xml/progress" >
</ProgressBar>
progress.xml: progress.xml:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" >
<shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="8"
android:useLevel="false" >
<size
android:height="48dip"
android:width="48dip" />
<gradient
android:centerY="0.50"
android:endColor="#000000"
android:startColor="#ffffff"
android:gradientRadius="20"
android:type="radial"
android:useLevel="false" />
</shape>
and in my activity 在我的活动中
protected void onPostExecute(Void result) {
bar.setProgress(50);
bar.setMax(100);
bar.setVisibility(View.VISIBLE);
}
The Circle stays black. 圆圈保持黑色。 If i set the gradient type to sweep, the circle fills with startcolor black and endcolor white.. and it constantly repeats.
如果我将渐变类型设置为扫描,则圆圈将填充startcolor black和endcolor white ..并且它会不断重复。
But I want the circle to be filled once.. so it starts black and fills white; 但我希望这个圆圈能够填充一次......所以它开始变黑并填充白色; only 1 time..
只有一次..
Is this possible? 这可能吗?
I want to reach this result: 我想达到这个结果:
http://ultimateprogrammingtutorials.blogspot.be/2013/02/how-to-draw-circular-progress-bar-in.html http://ultimateprogrammingtutorials.blogspot.be/2013/02/how-to-draw-circular-progress-bar-in.html
这是CircularProgressBar的一个很好的例子,根据你的要求希望这会对你有所帮助
An example of how to do this: 如何执行此操作的示例:
https://github.com/Todd-Davies/ProgressWheel https://github.com/Todd-Davies/ProgressWheel
There are many similar questions on stackoverflow: stackoverflow上有许多类似的问题:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.