【问题标题】:Android progress bar fillAndroid进度条填充
【发布时间】:2013-03-28 12:25:03
【问题描述】:

我想要一个圆形的加载栏。我想用我试过的整数填充它

 <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:

<?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>

在我的活动中

    protected void onPostExecute(Void result) {

            bar.setProgress(50);
            bar.setMax(100);
            bar.setVisibility(View.VISIBLE);
    }

圆圈保持黑色。如果我将渐变类型设置为扫描,则圆圈将填充黑色起始色和白色结束色......并且它会不断重复。

但我希望圆圈被填充一次......所以它从黑色开始并填充白色;只有1次..

这可能吗?

我想达到这个结果:

http://ultimateprogrammingtutorials.blogspot.be/2013/02/how-to-draw-circular-progress-bar-in.html

【问题讨论】:

  • 我们应该猜这个问题还是你会在这里问你想要什么??
  • 请再次阅读我的帖子,我已编辑.. 谢谢!

标签: java android progress-bar gradient radial


【解决方案1】:

here 是 CircularProgressBar 的一个很好的例子,根据您的要求希望这对您有所帮助

【讨论】:

    【解决方案2】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多