2013-02-27 94 views
0

如何像手錶中的第二根棒一樣旋轉imageview?如何ImageView在360度中心旋轉?

我想系統時間得到如果第二個是30所以圖像旋轉180度請看我的代碼我已經在線程中實現,但不啓動和移動imageview。

感謝您的支持。

final Handler mHandler = new Handler(); 

    new Thread(new Runnable() { 
     @Override 
     public void run() { 

      while (true) { 
       try { 
        Thread.sleep(1000); 
        mHandler.post(new Runnable() { 

         @Override 
         public void run() { 

          Date date = new Date(); 

          second = date.getSeconds(); 

          float f = second * 6; 

          Log.e("AnimatoinView", "Second:-" + second 
            + " Degree:-" + f); 

          RotateAnimation anim = new RotateAnimation(
            f, 360, 36, 34); 

          mBlueCircleImageView.setAnimation(anim); 

         } 
        }); 
       } catch (Exception e) { 

       } 
      } 
     } 
    }).start(); 

回答

1

嘗試的mBlueCircleImageView.startAnimation(anim);代替mBlueCircleImageView.setAnimation(anim);

+0

感謝FRND這是小錯誤,我再次失去了3-4個小時感謝.. – 2013-02-27 10:38:45