它是一个测验应用程序,最后它将显示总分,正确答案和总问题。圆形进度条用于显示总问题中的正确答案。问题是绿色一旦完成圆圈就会连续移动它再次开始移动我希望它不应该移动。
这是Circular_done.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape
android:shape="ring"
android:innerRadius="40dp"
android:thickness="10dp"
android:useLevel="false">
<solid android:color="#ffffff"></solid>
</shape>
</item>
<item android:id="@android:id/progress">
<rotate
android:fromDegrees="270"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="270">
<shape
android:innerRadius="40dp"
android:shape="ring"
android:thickness="10dp"
android:useLevel="true">
<rotate
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" />
<gradient
android:centerColor="#00FF00"
android:endColor="#00FF00"
android:startColor="#00FF00"
android:type="sweep" />
</shape>
</rotate>
</item>
下面是我的xml代码
<ProgressBar
android:id="@+id/doneProgressBar"
android:layout_width="110dp"
android:layout_height="110dp"
android:max="100"
android:layout_centerHorizontal="true"
android:layout_gravity="top"
style="?android:attr/progressBarStyleLarge"
android:indeterminateTintMode="src_in"
android:indeterminateDrawable="@drawable/circular_done" />
和我的java代码
final int Score = extra.getInt("SCORE");
final int totalQuestion = extra.getInt("TOTAL");
int correctAnswer = extra.getInt("CORRECT");
final String Cat=extra.getString("CAT");
txtTotalScore.setText(String.format("SCORE : %d", Score));
txtTotalQuestion.setText(String.format("PASSED : %d/%d", correctAnswer, totalQuestion));
progressBarResult.setMax(totalQuestion);
progressBarResult.setProgress(correctAnswer);