[英]rotate image in android imageview
我想構建一個應用程序,我通過(ImageView)顯示圖像。 和應用程序中的文本框。 我希望每秒鍾連續旋轉圖像大約10度。 當圖像旋轉時,文本框應顯示圖像旋轉的次數。 我嘗試旋轉圖像,但每次應用程序崩潰或沒有出現在屏幕上。
有人可以用代碼plz幫我嗎?
謝謝
使用此代碼創建動畫旅館res / anim
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:duration="36000" />
並在您的活動中:
Animation rotate = AnimationUtils.loadAnimation(this, R.anim.rotate);
findViewById(R.id.yourImageId).startAnimation(rotate);
rotate.reset();
rotate.start();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.