自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

優(yōu)酷旋轉(zhuǎn)菜單

移動(dòng)開發(fā)
自定義view優(yōu)酷菜單-其實(shí)就是旋轉(zhuǎn)動(dòng)畫使用.

源碼簡介:自定義view優(yōu)酷菜單-其實(shí)就是旋轉(zhuǎn)動(dòng)畫使用.

源碼效果:

源碼片段:

  1. package com.kincai.zhuanti_coustom_view_youku_menu; 
  2.   
  3. import android.view.animation.Animation; 
  4. import android.view.animation.Animation.AnimationListener; 
  5. import android.view.animation.RotateAnimation; 
  6. import android.widget.RelativeLayout; 
  7.   
  8. /** 
  9.  *  
  10.  * @company KCS互聯(lián)網(wǎng)有限公司 
  11.  *  
  12.  * @copyright KCS互聯(lián)網(wǎng)有限公司版權(quán)所有 (c) 2014-2015 
  13.  *  
  14.  * @author kincai 
  15.  *  
  16.  * @description 動(dòng)畫工具 
  17.  *  
  18.  * @project Zhuanti_Coustom_View_youku_menu 
  19.  *  
  20.  * @package com.kincai.zhuanti_coustom_view_youku_menu 
  21.  *  
  22.  * @time 2015-7-24 下午7:18:13 
  23.  *  
  24.  */ 
  25. public class AnimUtil { 
  26.     /** 記錄當(dāng)前執(zhí)行的動(dòng)畫數(shù)量 */ 
  27.     public static int animCount = 0
  28.   
  29.     /** 
  30.      * 顯示或隱藏菜單 
  31.      *  
  32.      * @param rl 
  33.      *            view 
  34.      * @param startOffset 
  35.      *            延時(shí)時(shí)間 
  36.      * @param isShow 
  37.      *            isShow == true 顯示 isShow == false 隱藏 
  38.      */ 
  39.     public static void showOrChoseMenu(RelativeLayout rl, int startOffset, 
  40.             boolean isShow) { 
  41.   
  42.         // RotateAnimation(float fromDegrees, float toDegrees, int pivotXType, 
  43.         // float pivotXValue, int pivotYType, float pivotYValue) 
  44.         // pivotXValue: 0-1 
  45.         /** 
  46.          * float fromDegrees, float toDegrees,角度從多少道多少 int pivotXType 
  47.          * x方向基于點(diǎn)的類型父控件或自己 float pivotXValue ,x方向基于的位置 
  48.          *  
  49.          */ 
  50.         RotateAnimation animation = null
  51.         if (isShow) { 
  52.             for (int i = 0; i < rl.getChildCount(); i++) { 
  53.                 rl.getChildAt(i).setEnabled(true); 
  54.             } 
  55.             animation = new RotateAnimation(-1800
  56.                     RotateAnimation.RELATIVE_TO_SELF, 0.5f, 
  57.                     RotateAnimation.RELATIVE_TO_SELF, 1); 
  58.         } else { 
  59.             for (int i = 0; i < rl.getChildCount(); i++) { 
  60.                 rl.getChildAt(i).setEnabled(false); 
  61.             } 
  62.             animation = new RotateAnimation(0, -180
  63.                     RotateAnimation.RELATIVE_TO_SELF, 0.5f, 
  64.                     RotateAnimation.RELATIVE_TO_SELF, 1); 
  65.         } 
  66.   
  67.         animation.setDuration(500); 
  68.         animation.setFillAfter(true);// 動(dòng)畫結(jié)束后保持當(dāng)時(shí)的狀態(tài) 就是動(dòng)畫結(jié)束的時(shí)候 就停止在那里不動(dòng)了 
  69.         animation.setStartOffset(startOffset);// 延時(shí) 
  70.   
  71.         animation.setAnimationListener(new MyAnimationListener()); 
  72.   
  73.         rl.startAnimation(animation); 
  74.     } 
  75.   
  76.     /** 
  77.      * 動(dòng)畫監(jiān)聽 
  78.      */ 
  79.     static class MyAnimationListener implements AnimationListener { 
  80.         @Override 
  81.         public void onAnimationStart(Animation animation) { 
  82.             animCount++; 
  83.         } 
  84.   
  85.         @Override 
  86.         public void onAnimationEnd(Animation animation) { 
  87.             animCount--; 
  88.         } 
  89.   
  90.         @Override 
  91.         public void onAnimationRepeat(Animation animation) { 
  92.         } 
  93.   
  94.     } 

下載地址:http://down.51cto.com/data/2103330

責(zé)任編輯:倪明 來源: devstore
相關(guān)推薦

2009-12-16 10:06:51

互聯(lián)網(wǎng)

2015-10-20 15:58:28

彈力菜單android源碼

2017-06-16 09:39:32

優(yōu)酷實(shí)踐阿里云

2011-12-13 14:44:02

360開放平臺(tái)

2015-08-20 17:22:03

京東

2010-01-18 15:39:41

互聯(lián)網(wǎng)

2014-06-09 14:44:44

Spark

2015-11-05 18:18:36

優(yōu)酷

2015-03-31 17:28:32

2013-12-03 16:47:50

優(yōu)酷百度

2014-03-27 09:36:36

Spark

2014-12-31 15:59:55

彈力菜單

2021-06-09 08:30:52

CSS33D旋轉(zhuǎn)視圖3D動(dòng)畫

2014-11-11 16:07:11

2012-03-12 17:24:23

優(yōu)酷土豆合并

2014-03-03 13:33:03

易傳媒移動(dòng)DSP

2015-09-22 16:30:29

魅族

2012-12-28 14:58:31

Android優(yōu)酷UI

2016-05-12 13:31:38

優(yōu)酷VR

2015-02-26 16:29:56

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)