在android中逐渐绘制圆圈

时间:2016-02-23 11:35:24

标签: android android-animation android-canvas android-drawable android-design-library

我希望逐渐显示一个在android中绘制的圆圈:

Drive REST API

我应该如何开始? 需要做什么?

1 个答案:

答案 0 :(得分:0)

 ProgressBar p
 p=(PregressBar)findViewById(R.id.p);
 ObjectAnimator animation = ObjectAnimator.ofInt (p, "progress", 0, 100);
    animation.setDuration (3000); 
    animation.setInterpolator (new DecelerateInterpolator ());
    animation.start ();`

然后在xml中

  <ProgressBar
android:id="@+id/p"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="@dimen/progreess_circle"
android:layout_height="@dimen/progreess_circle"
android:layout_gravity="center"
android:rotation="270"
android:progress="0"
android:drawingCacheQuality="low"
android:progressDrawable="@drawable/circular" />

Circular.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:innerRadiusRatio="2.3"
android:shape="ring"
android:thickness="10sp" >
<solid android:color="@color/yellow_text_color" />