こちらのレーダーアニメーションとの差異は、2つのxml定義のみ。
app/src/main/res/drawable/radar.xml
app/src/main/res/anim/radar.xml
https://github.com/remixgrjp/Circle-Radar-animation
app/src/main/res/drawable/radar.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:innerRadius="0dp" ★ ring内側の円なし android:thicknessRatio="2" ★ 絶対座標非依存 android:useLevel="false" > <gradient android:type="sweep" android:startColor="#00000000" android:centerColor="#00000000" ★ 半分以上透明 android:endColor="#2F00FF00" /> </shape>これらを自身の中心座標で360度回転アニメーションする定義。
app/src/main/res/anim/radar.xml
<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator" android:repeatCount="-1" ★ 繰り返し無制限 android:fromDegrees="0.0" android:toDegrees="360.0" android:pivotX="50%" ★ 絶対座標非依存 android:pivotY="50%" ★ 絶対座標非依存 android:duration="3000" />ソースは github に。コンパイル済みのAPKもこちらに。
https://github.com/remixgrjp/Circle-Radar-animation