码迷,mamicode.com
首页 > 其他好文 > 详细

ViewHelper.setTranslationY(view,float)函数的解释

时间:2015-06-08 23:03:12      阅读:1115      评论:0      收藏:0      [点我收藏+]

标签:

参考:http://blog.csdn.net/lixiaodaoaaa/article/details/41310233

 需要集成nineoldandroid.jar

  1. package com.nineoldandroids.view;
  2.  
  3. import android.view.View;
  4.  
  5. import static com.nineoldandroids.view.animation.AnimatorProxy.NEEDS_PROXY;
  6. import static com.nineoldandroids.view.animation.AnimatorProxy.wrap;
  7.  
  8. public final class ViewHelper {
  9. private ViewHelper() {}
  10.  
  11. public static float getAlpha(View view) {
  12. return NEEDS_PROXY ? wrap(view).getAlpha() : Honeycomb.getAlpha(view);
  13. }
  14.  
  15. public static void setAlpha(View view, float alpha) {
  16. if (NEEDS_PROXY) {
  17. wrap(view).setAlpha(alpha);
  18. } else {
  19. Honeycomb.setAlpha(view, alpha);
  20. }
  21. }
  22.  
  23. public static float getPivotX(View view) {
  24. return NEEDS_PROXY ? wrap(view).getPivotX() : Honeycomb.getPivotX(view);
  25. }
  26.  
  27. public static void setPivotX(View view, float pivotX) {
  28. if (NEEDS_PROXY) {
  29. wrap(view).setPivotX(pivotX);
  30. } else {
  31. Honeycomb.setPivotX(view, pivotX);
  32. }
  33. }
  34.  
  35. public static float getPivotY(View view) {
  36. return NEEDS_PROXY ? wrap(view).getPivotY() : Honeycomb.getPivotY(view);
  37. }
  38.  
  39. public static void setPivotY(View view, float pivotY) {
  40. if (NEEDS_PROXY) {
  41. wrap(view).setPivotY(pivotY);
  42. } else {
  43. Honeycomb.setPivotY(view, pivotY);
  44. }
  45. }
  46.  
  47. public static float getRotation(View view) {
  48. return NEEDS_PROXY ? wrap(view).getRotation() : Honeycomb.getRotation(view);
  49. }
  50.  
  51. public static void setRotation(View view, float rotation) {
  52. if (NEEDS_PROXY) {
  53. wrap(view).setRotation(rotation);
  54. } else {
  55. Honeycomb.setRotation(view, rotation);
  56. }
  57. }
  58.  
  59. public static float getRotationX(View view) {
  60. return NEEDS_PROXY ? wrap(view).getRotationX() : Honeycomb.getRotationX(view);
  61. }
  62.  
  63. public static void setRotationX(View view, float rotationX) {
  64. if (NEEDS_PROXY) {
  65. wrap(view).setRotationX(rotationX);
  66. } else {
  67. Honeycomb.setRotationX(view, rotationX);
  68. }
  69. }
  70.  
  71. public static float getRotationY(View view) {
  72. return NEEDS_PROXY ? wrap(view).getRotationY() : Honeycomb.getRotationY(view);
  73. }
  74.  
  75. public static void setRotationY(View view, float rotationY) {
  76. if (NEEDS_PROXY) {
  77. wrap(view).setRotationY(rotationY);
  78. } else {
  79. Honeycomb.setRotationY(view, rotationY);
  80. }
  81. }
  82.  
  83. public static float getScaleX(View view) {
  84. return NEEDS_PROXY ? wrap(view).getScaleX() : Honeycomb.getScaleX(view);
  85. }
  86.  
  87. public static void setScaleX(View view, float scaleX) {
  88. if (NEEDS_PROXY) {
  89. wrap(view).setScaleX(scaleX);
  90. } else {
  91. Honeycomb.setScaleX(view, scaleX);
  92. }
  93. }
  94.  
  95. public static float getScaleY(View view) {
  96. return NEEDS_PROXY ? wrap(view).getScaleY() : Honeycomb.getScaleY(view);
  97. }
  98.  
  99. public static void setScaleY(View view, float scaleY) {
  100. if (NEEDS_PROXY) {
  101. wrap(view).setScaleY(scaleY);
  102. } else {
  103. Honeycomb.setScaleY(view, scaleY);
  104. }
  105. }
  106.  
  107. public static float getScrollX(View view) {
  108. return NEEDS_PROXY ? wrap(view).getScrollX() : Honeycomb.getScrollX(view);
  109. }
  110.  
  111. public static void setScrollX(View view, int scrollX) {
  112. if (NEEDS_PROXY) {
  113. wrap(view).setScrollX(scrollX);
  114. } else {
  115. Honeycomb.setScrollX(view, scrollX);
  116. }
  117. }
  118.  
  119. public static float getScrollY(View view) {
  120. return NEEDS_PROXY ? wrap(view).getScrollY() : Honeycomb.getScrollY(view);
  121. }
  122.  
  123. public static void setScrollY(View view, int scrollY) {
  124. if (NEEDS_PROXY) {
  125. wrap(view).setScrollY(scrollY);
  126. } else {
  127. Honeycomb.setScrollY(view, scrollY);
  128. }
  129. }
  130.  
  131. public static float getTranslationX(View view) {
  132. return NEEDS_PROXY ? wrap(view).getTranslationX() : Honeycomb.getTranslationX(view);
  133. }
  134.  
  135. public static void setTranslationX(View view, float translationX) {
  136. if (NEEDS_PROXY) {
  137. wrap(view).setTranslationX(translationX);
  138. } else {
  139. Honeycomb.setTranslationX(view, translationX);
  140. }
  141. }
  142.  
  143. public static float getTranslationY(View view) {
  144. return NEEDS_PROXY ? wrap(view).getTranslationY() : Honeycomb.getTranslationY(view);
  145. }
  146.  
  147. public static void setTranslationY(View view, float translationY) {
  148. if (NEEDS_PROXY) {
  149. wrap(view).setTranslationY(translationY);
  150. } else {
  151. Honeycomb.setTranslationY(view, translationY);
  152. }
  153. }
  154.  
  155. public static float getX(View view) {
  156. return NEEDS_PROXY ? wrap(view).getX() : Honeycomb.getX(view);
  157. }
  158.  
  159. public static void setX(View view, float x) {
  160. if (NEEDS_PROXY) {
  161. wrap(view).setX(x);
  162. } else {
  163. Honeycomb.setX(view, x);
  164. }
  165. }
  166.  
  167. public static float getY(View view) {
  168. return NEEDS_PROXY ? wrap(view).getY() : Honeycomb.getY(view);
  169. }
  170.  
  171. public static void setY(View view, float y) {
  172. if (NEEDS_PROXY) {
  173. wrap(view).setY(y);
  174. } else {
  175. Honeycomb.setY(view, y);
  176. }
  177. }
  178.  
  179. private static final class Honeycomb {
  180. static float getAlpha(View view) {
  181. return view.getAlpha();
  182. }
  183.  
  184. static void setAlpha(View view, float alpha) {
  185. view.setAlpha(alpha);
  186. }
  187.  
  188. static float getPivotX(View view) {
  189. return view.getPivotX();
  190. }
  191.  
  192. static void setPivotX(View view, float pivotX) {
  193. view.setPivotX(pivotX);
  194. }
  195.  
  196. static float getPivotY(View view) {
  197. return view.getPivotY();
  198. }
  199.  
  200. static void setPivotY(View view, float pivotY) {
  201. view.setPivotY(pivotY);
  202. }
  203.  
  204. static float getRotation(View view) {
  205. return view.getRotation();
  206. }
  207.  
  208. static void setRotation(View view, float rotation) {
  209. view.setRotation(rotation);
  210. }
  211.  
  212. static float getRotationX(View view) {
  213. return view.getRotationX();
  214. }
  215.  
  216. static void setRotationX(View view, float rotationX) {
  217. view.setRotationX(rotationX);
  218. }
  219.  
  220. static float getRotationY(View view) {
  221. return view.getRotationY();
  222. }
  223.  
  224. static void setRotationY(View view, float rotationY) {
  225. view.setRotationY(rotationY);
  226. }
  227.  
  228. static float getScaleX(View view) {
  229. return view.getScaleX();
  230. }
  231.  
  232. static void setScaleX(View view, float scaleX) {
  233. view.setScaleX(scaleX);
  234. }
  235.  
  236. static float getScaleY(View view) {
  237. return view.getScaleY();
  238. }
  239.  
  240. static void setScaleY(View view, float scaleY) {
  241. view.setScaleY(scaleY);
  242. }
  243.  
  244. static float getScrollX(View view) {
  245. return view.getScrollX();
  246. }
  247.  
  248. static void setScrollX(View view, int scrollX) {
  249. view.setScrollX(scrollX);
  250. }
  251.  
  252. static float getScrollY(View view) {
  253. return view.getScrollY();
  254. }
  255.  
  256. static void setScrollY(View view, int scrollY) {
  257. view.setScrollY(scrollY);
  258. }
  259.  
  260. static float getTranslationX(View view) {
  261. return view.getTranslationX();
  262. }
  263.  
  264. static void setTranslationX(View view, float translationX) {
  265. view.setTranslationX(translationX);
  266. }
  267.  
  268. static float getTranslationY(View view) {
  269. return view.getTranslationY();
  270. }
  271.  
  272. static void setTranslationY(View view, float translationY) {
  273. view.setTranslationY(translationY);
  274. }
  275.  
  276. static float getX(View view) {
  277. return view.getX();
  278. }
  279.  
  280. static void setX(View view, float x) {
  281. view.setX(x);
  282. }
  283.  
  284. static float getY(View view) {
  285. return view.getY();
  286. }
  287.  
  288. static void setY(View view, float y) {
  289. view.setY(y);
  290. }
  291. }
  292. }

ViewHelper.setTranslationY(view,float)函数的解释

标签:

原文地址:http://www.cnblogs.com/superle/p/4562107.html

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!