간격이있는 원형 모양을 만들어야합니다.Android 반지 모양의 분할로
시계를 나타내는 진행률 막대를 만듭니다. 각 간격은 12 시간으로 지정됩니다.
이 내가 달성하고자 정확히 것입니다.
activity.xml
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="200dp"
android:layout_height="200dp"
android:indeterminate="false"
android:progressDrawable="@drawable/circular_progress_bar"
android:background="@drawable/circle_shape"
style="?android:attr/progressBarStyleHorizontal"
android:max="500"
android:progress="65"
android:layout_marginBottom="165dp"
android:layout_above="@+id/button5"
android:layout_centerHorizontal="true" />
에서 circular_progress_bar
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="270"
android:toDegrees="270">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thickness="4dp"
android:useLevel="true"><!-- this line fixes the issue for lollipop api 21 -->
<gradient
android:angle="0"
android:endColor="#007DD6"
android:startColor="#007DD6"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
에서 circle_shape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring"
android:innerRadiusRatio="2.5"
android:thickness="4dp"
android:useLevel="false">
<solid android:color="#CCC" />
<stroke
android:dashGap="10px"
android:dashWidth="10px"
android:width="1dp"
android:color="#ababb2" />
</shape>
에서 (죽음의 별에 외부 링) 여기
지금까지 내 코드입니다
내 모양을 어떻게 분리합니까? 나는 올바른 길을 가고 있는가?
당신이 더 정교한 수 있습니다
나는 GitHub의에서 당신을 위해이 솔루션과 프로젝트를했습니다. 어디로 간다. 임 완전하게 안드로이드에 새로운. 단지 몇 가지 작은 프로젝트를 통해 그것을 배우기로 결심했습니다. 그리고 이것은 zooper 위젯을 재창조 한 첫 번째 프로젝트입니다. – CBeTJlu4ok전체 클래스와 예제 응용 프로그램에 대한 github 링크에 대한 자세한 설명을 추가했습니다. 왜 누군가가 나를 downvoted ...하지만 어쩌면이 문제에 대한 더 나은 솔루션 –