我有一個內部繪圖的圖像視圖。這可繪製是一個類似於存在於進度對話框的環:如何旋轉drawable而不是imageView本身?
loading_ring:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring"
android:innerRadiusRatio="3"
android:thicknessRatio="8"
android:useLevel="false">
<size
android:width="20dip"
android:height="20dip"/>
<gradient
android:type="sweep"
android:useLevel="false"
android:startColor="#4c737373"
android:centerColor="#4c737373"
android:centerY="0.50"
android:endColor="#ffffffff"/>
</shape>
爲了旋轉該環我已經創建了一個旋轉的動畫像這樣:
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="359"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:duration="1000"
android:interpolator="@android:anim/linear_interpolator" />
但當我在imageView上應用動畫時:
this.cameraView.setAnimation(AnimationUtils.loadAnimation(this,R.anim.loadinganimation));
all imageVie w正在旋轉。我只想旋轉戒指(imageview的src)我怎麼能實現這一目標?
感謝
你能詳細介紹一下你的答案嗎? 「製作兩個分開的視圖」是什麼意思,兩個視圖是什麼? – grunk
@grunk:我剛剛編輯了我的答案。 – Macarse
好的感謝您的更新。我已經在使用這個「技巧」,但我希望有一個更清潔的方法。無論如何都要上傳,稍等一會再接受;) – grunk