源文:http://mobile.51cto.com/abased-401983.htm

为了使界面的效果更加绚丽,体验效果更佳,往往需要开发者们自行开发新的界面效果,在这里,我将奉上各种实现折叠效果的Demo,供大家一同分享。

AD:WOT2014:用户标签系统与用户数据化运营培训专场

源码效果地址:https://github.com/openaphid/android-flip.git

废话不多说,直接上代码:

MainActivity.java 
  1. /*
  2. Copyright 2012 Aphid Mobile
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package com.aphidmobile.flip.demo;
  14. import android.app.Activity;
  15. import android.app.ListActivity;
  16. import android.content.Intent;
  17. import android.net.Uri;
  18. import android.os.Bundle;
  19. import android.view.*;
  20. import android.widget.ListView;
  21. import android.widget.SimpleAdapter;
  22. import com.aphidmobile.flipview.demo.R;
  23. import java.util.*;
  24. public class MainActivity extends ListActivity {
  25. @Override
  26. protected void onCreate(Bundle savedInstanceState) {
  27. super.onCreate(savedInstanceState);
  28. setListAdapter(
  29. new SimpleAdapter(
  30. this, getData(), android.R.layout.simple_list_item_1, new String[]{"title"}, new int[]{android.R.id.text1}
  31. )
  32. );
  33. getListView().setScrollbarFadingEnabled(false);
  34. }
  35. @Override
  36. public boolean onCreateOptionsMenu(Menu menu) {
  37. getMenuInflater().inflate(R.menu.main, menu);
  38. return true;
  39. }
  40. @Override
  41. public boolean onOptionsItemSelected(MenuItem item) {
  42. Intent intent = new Intent(
  43. Intent.ACTION_VIEW,
  44. Uri.parse("http://openaphid.github.com/")
  45. );
  46. startActivity(intent);
  47. return true;
  48. }
  49. @SuppressWarnings("unchecked")
  50. @Override
  51. protected void onListItemClick(ListView l, View v, int position, long id) {
  52. Map<String, Object> map = (Map<String, Object>) l.getItemAtPosition(position);
  53. Intent intent = new Intent(this, (Class<? extends Activity>)map.get("activity"));
  54. startActivity(intent);
  55. }
  56. private List<? extends Map<String, ?>> getData() {
  57. List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();
  58. addItem(data, "TextViews", FlipTextViewActivity.class);
  59. addItem(data, "Buttons", FlipButtonActivity.class);
  60. addItem(data, "Complex Layouts", FlipComplexLayoutActivity.class);
  61. addItem(data, "Async Content", FlipAsyncContentActivity.class);
  62. addItem(data, "Event Listener", FlipTextViewAltActivity.class);
  63. addItem(data, "Horizontal", FlipHorizontalLayoutActivity.class);
  64. addItem(data, "Issue #5", Issue5Activity.class);
  65. addItem(data, "XML Configuration", FlipTextViewXmlActivity.class);
  66. addItem(data, "Fragment", FlipFragmentActivity.class);
  67. addItem(data, "Dynamic Adapter Size", FlipDynamicAdapterActivity.class);
  68. return data;
  69. }
  70. private void addItem(List<Map<String, Object>> data, String title, Class<? extends Activity> activityClass) {
  71. Map<String, Object> map = new HashMap<String, Object>();
  72. map.put("title", data.size() + ". " + title);
  73. map.put("activity", activityClass);
  74. data.add(map);
  75. }
  76. }

FlipViewController.java

  1. /*
  2. Copyright 2012 Aphid Mobile
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package com.aphidmobile.flip;
  14. import android.content.Context;
  15. import android.content.res.Configuration;
  16. import android.content.res.TypedArray;
  17. import android.database.DataSetObserver;
  18. import android.graphics.Bitmap;
  19. import android.graphics.PixelFormat;
  20. import android.opengl.GLSurfaceView;
  21. import android.os.Handler;
  22. import android.os.Message;
  23. import android.util.AttributeSet;
  24. import android.view.*;
  25. import android.widget.AbsListView;
  26. import android.widget.Adapter;
  27. import android.widget.AdapterView;
  28. import com.aphidmobile.utils.AphidLog;
  29. import com.openaphid.flip.R;
  30. import junit.framework.Assert;
  31. import java.util.LinkedList;
  32. public class FlipViewController extends AdapterView<Adapter> {
  33. public static final int VERTICAL = 0;
  34. public static final int HORIZONTAL = 1;
  35. public static interface ViewFlipListener {
  36. void onViewFlipped(View view, int position);
  37. }
  38. private static final int MAX_RELEASED_VIEW_SIZE = 1;
  39. private static final int MSG_SURFACE_CREATED = 1;
  40. private Handler handler = new Handler(new Handler.Callback() {
  41. @Override
  42. public boolean handleMessage(Message msg) {
  43. if (msg.what == MSG_SURFACE_CREATED) {
  44. contentWidth = 0;
  45. contentHeight = 0;
  46. requestLayout();
  47. return true;
  48. }
  49. return false;
  50. }
  51. });
  52. private GLSurfaceView surfaceView;
  53. private FlipRenderer renderer;
  54. private FlipCards cards;
  55. private int contentWidth;
  56. private int contentHeight;
  57. @ViewDebug.ExportedProperty
  58. private int flipOrientation;
  59. private boolean inFlipAnimation = false;
  60. //AdapterView Related
  61. private Adapter adapter;
  62. private int adapterDataCount = 0;
  63. private DataSetObserver adapterDataObserver;
  64. private final LinkedList<View> bufferedViews = new LinkedList<View>();
  65. private final LinkedList<View> releasedViews = new LinkedList<View>(); //XXX: use a SparseArray to keep the related view indices?
  66. private int bufferIndex = -1;
  67. private int adapterIndex = -1;
  68. private int sideBufferSize = 1;
  69. private float touchSlop;
  70. private ViewFlipListener onViewFlipListener;
  71. @ViewDebug.ExportedProperty
  72. private Bitmap.Config animationBitmapFormat = Bitmap.Config.ARGB_8888;
  73. public FlipViewController(Context context) {
  74. this(context, VERTICAL);
  75. }
  76. public FlipViewController(Context context, int flipOrientation) {
  77. super(context);
  78. init(context, flipOrientation);
  79. }
  80. /**
  81. * Constructor required for XML inflation.
  82. */
  83. public FlipViewController(Context context, AttributeSet attrs, int defStyle) {
  84. super(context, attrs, defStyle);
  85. int orientation = VERTICAL;
  86. TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.FlipViewController, 0, 0);
  87. try {
  88. int value = a.getInteger(R.styleable.FlipViewController_orientation, VERTICAL);
  89. if (value == HORIZONTAL)
  90. orientation = HORIZONTAL;
  91. value = a.getInteger(R.styleable.FlipViewController_animationBitmapFormat, 0);
  92. if (value == 1)
  93. setAnimationBitmapFormat(Bitmap.Config.ARGB_4444);
  94. else if (value == 2)
  95. setAnimationBitmapFormat(Bitmap.Config.RGB_565);
  96. else
  97. setAnimationBitmapFormat(Bitmap.Config.ARGB_8888);
  98. } finally {
  99. a.recycle();
  100. }
  101. init(context, orientation);
  102. }
  103. /**
  104. * Constructor required for XML inflation.
  105. */
  106. public FlipViewController(Context context, AttributeSet attrs) {
  107. this(context, attrs, 0);
  108. }
  109. private void init(Context context, int orientation) {
  110. ViewConfiguration configuration = ViewConfiguration.get(getContext());
  111. touchSlop = configuration.getScaledTouchSlop();
  112. this.flipOrientation = orientation;
  113. setupSurfaceView(context);
  114. }
  115. public Bitmap.Config getAnimationBitmapFormat() {
  116. return animationBitmapFormat;
  117. }
  118. /**
  119. * Set the bitmap config for the animation, default is ARGB_8888, which provides the best quality with large peak memory consumption.
  120. *
  121. * @param animationBitmapFormat ALPHA_8 is not supported and will throw exception when binding textures
  122. */
  123. public void setAnimationBitmapFormat(Bitmap.Config animationBitmapFormat) {
  124. this.animationBitmapFormat = animationBitmapFormat;
  125. }
  126. public ViewFlipListener getOnViewFlipListener() {
  127. return onViewFlipListener;
  128. }
  129. public void setOnViewFlipListener(ViewFlipListener onViewFlipListener) {
  130. this.onViewFlipListener = onViewFlipListener;
  131. }
  132. public void onResume() {
  133. surfaceView.onResume();
  134. }
  135. public void onPause() {
  136. surfaceView.onPause();
  137. }
  138. /**
  139. * Request the animator to update display if the pageView has been preloaded.
  140. * <p/>
  141. * If the pageView is being used in the animation or its content has been buffered, the animator forcibly reloads it.
  142. * <p/>
  143. * The reloading process is a bit heavy for an active page, so please don't invoke it too frequently for an active page. The cost is trivial for inactive pages.
  144. *
  145. * @param pageView
  146. */
  147. public void refreshPage(View pageView) {
  148. if (cards.refreshPageView(pageView))
  149. requestLayout();
  150. }
  151. /**
  152. * @param pageIndex
  153. * @see #refreshPage(android.view.View)
  154. */
  155. public void refreshPage(int pageIndex) {
  156. if (cards.refreshPage(pageIndex))
  157. requestLayout();
  158. }
  159. /**
  160. * Force the animator reload all preloaded pages
  161. */
  162. public void refreshAllPages() {
  163. cards.refreshAllPages();
  164. requestLayout();
  165. }
  166. //--------------------------------------------------------------------------------------------------------------------
  167. // Touch Event
  168. @Override
  169. public boolean onInterceptTouchEvent(MotionEvent event) {
  170. return cards.handleTouchEvent(event, false);
  171. }
  172. @Override
  173. public boolean onTouchEvent(MotionEvent event) {
  174. return cards.handleTouchEvent(event, true);
  175. }
  176. //--------------------------------------------------------------------------------------------------------------------
  177. // Orientation
  178. @Override
  179. protected void onConfigurationChanged(Configuration newConfig) {
  180. super.onConfigurationChanged(newConfig);
  181. //XXX: adds a global layout listener?
  182. }
  183. //--------------------------------------------------------------------------------------------------------------------
  184. // AdapterView<Adapter>
  185. @Override
  186. public Adapter getAdapter() {
  187. return adapter;
  188. }
  189. @Override
  190. public void setAdapter(Adapter adapter) {
  191. setAdapter(adapter, 0);
  192. }
  193. public void setAdapter(Adapter adapter, int initialPosition) {
  194. if (this.adapter != null)
  195. this.adapter.unregisterDataSetObserver(adapterDataObserver);
  196. Assert.assertNotNull("adapter should not be null", adapter);
  197. this.adapter = adapter;
  198. adapterDataCount = adapter.getCount();
  199. adapterDataObserver = new MyDataSetObserver();
  200. this.adapter.registerDataSetObserver(adapterDataObserver);
  201. if (adapterDataCount > 0)
  202. setSelection(initialPosition);
  203. }
  204. @Override
  205. public View getSelectedView() {
  206. return (bufferIndex < bufferedViews.size() && bufferIndex >= 0) ? bufferedViews.get(bufferIndex) : null;
  207. }
  208. @Override
  209. public void setSelection(int position) {
  210. if (adapter == null)
  211. return;
  212. Assert.assertTrue("Invalid selection position", position >= 0 && position < adapterDataCount);
  213. releaseViews();
  214. View selectedView = viewFromAdapter(position, true);
  215. bufferedViews.add(selectedView);
  216. for (int i = 1; i <= sideBufferSize; i++) {
  217. int previous = position - i;
  218. int next = position + i;
  219. if (previous >= 0)
  220. bufferedViews.addFirst(viewFromAdapter(previous, false));
  221. if (next < adapterDataCount)
  222. bufferedViews.addLast(viewFromAdapter(next, true));
  223. }
  224. bufferIndex = bufferedViews.indexOf(selectedView);
  225. adapterIndex = position;
  226. requestLayout();
  227. updateVisibleView(inFlipAnimation ? -1 : bufferIndex);
  228. cards.resetSelection(position, adapterDataCount);
  229. }
  230. @Override
  231. public int getSelectedItemPosition() {
  232. return adapterIndex;
  233. }
  234. //--------------------------------------------------------------------------------------------------------------------
  235. // Layout
  236. @Override
  237. protected void onLayout(boolean changed, int l, int t, int r, int b) {
  238. if (AphidLog.ENABLE_DEBUG)
  239. AphidLog.d("onLayout: %d, %d, %d, %d; child %d", l, t, r, b, bufferedViews.size());
  240. for (View child : bufferedViews)
  241. child.layout(0, 0, r - l, b - t);
  242. if (changed || contentWidth == 0) {
  243. int w = r - l;
  244. int h = b - t;
  245. surfaceView.layout(0, 0, w, h);
  246. if (contentWidth != w || contentHeight != h) {
  247. contentWidth = w;
  248. contentHeight = h;
  249. }
  250. }
  251. if (bufferedViews.size() >= 1) {
  252. View frontView = bufferedViews.get(bufferIndex);
  253. View backView = null;
  254. if (bufferIndex < bufferedViews.size() - 1)
  255. backView = bufferedViews.get(bufferIndex + 1);
  256. renderer.updateTexture(adapterIndex, frontView, backView == null ? -1 : adapterIndex + 1, backView);
  257. }
  258. }
  259. @Override
  260. protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  261. super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  262. for (View child : bufferedViews)
  263. child.measure(widthMeasureSpec, heightMeasureSpec);
  264. surfaceView.measure(widthMeasureSpec, heightMeasureSpec);
  265. }
  266. //--------------------------------------------------------------------------------------------------------------------
  267. //internal exposed properties & methods
  268. float getTouchSlop() {
  269. return touchSlop;
  270. }
  271. GLSurfaceView getSurfaceView() {
  272. return surfaceView;
  273. }
  274. FlipRenderer getRenderer() {
  275. return renderer;
  276. }
  277. int getContentWidth() {
  278. return contentWidth;
  279. }
  280. int getContentHeight() {
  281. return contentHeight;
  282. }
  283. void reloadTexture() {
  284. handler.sendMessage(Message.obtain(handler, MSG_SURFACE_CREATED));
  285. }
  286. //--------------------------------------------------------------------------------------------------------------------
  287. // Internals
  288. private void setupSurfaceView(Context context) {
  289. surfaceView = new GLSurfaceView(getContext());
  290. cards = new FlipCards(this, flipOrientation == VERTICAL);
  291. renderer = new FlipRenderer(this, cards);
  292. surfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
  293. surfaceView.setZOrderOnTop(true);
  294. surfaceView.setRenderer(renderer);
  295. surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
  296. surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
  297. addViewInLayout(surfaceView, -1, new AbsListView.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT), false);
  298. }
  299. private void releaseViews() {
  300. for (View view : bufferedViews)
  301. releaseView(view);
  302. bufferedViews.clear();
  303. bufferIndex = -1;
  304. adapterIndex = -1;
  305. }
  306. private void releaseView(View view) {
  307. Assert.assertNotNull(view);
  308. detachViewFromParent(view);
  309. addReleasedView(view);
  310. }
  311. private void addReleasedView(View view) {
  312. Assert.assertNotNull(view);
  313. if (releasedViews.size() < MAX_RELEASED_VIEW_SIZE)
  314. releasedViews.add(view);
  315. }
  316. private View viewFromAdapter(int position, boolean addToTop) {
  317. Assert.assertNotNull(adapter);
  318. View releasedView = releasedViews.isEmpty() ? null : releasedViews.removeFirst();
  319. View view = adapter.getView(position, releasedView, this);
  320. if (releasedView != null && view != releasedView)
  321. addReleasedView(releasedView);
  322. setupAdapterView(view, addToTop, view == releasedView);
  323. return view;
  324. }
  325. private void setupAdapterView(View view, boolean addToTop, boolean isReusedView) {
  326. LayoutParams params = view.getLayoutParams();
  327. if (params == null) {
  328. params = new AbsListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0);
  329. }
  330. if (isReusedView)
  331. attachViewToParent(view, addToTop ? 0 : 1, params);
  332. else
  333. addViewInLayout(view, addToTop ? 0 : 1, params, true);
  334. }
  335. private void updateVisibleView(int index) {
  336. /*
  337. if (AphidLog.ENABLE_DEBUG)
  338. AphidLog.d("Update visible views, index %d, buffered: %d, adapter %d", index, bufferedViews.size(), adapterIndex);
  339. */
  340. for (int i = 0; i < bufferedViews.size(); i++)
  341. bufferedViews.get(i).setVisibility(index == i ? VISIBLE : INVISIBLE);
  342. }
  343. private void debugBufferedViews() {
  344. if (AphidLog.ENABLE_DEBUG)
  345. AphidLog.d("bufferedViews: %s; buffer index %d, adapter index %d", bufferedViews, bufferIndex, adapterIndex);
  346. }
  347. void postFlippedToView(final int indexInAdapter) {
  348. handler.post(new Runnable() {
  349. @Override
  350. public void run() {
  351. flippedToView(indexInAdapter, true);
  352. }
  353. });
  354. }
  355. void flippedToView(final int indexInAdapter, boolean isPost) {
  356. if (AphidLog.ENABLE_DEBUG)
  357. AphidLog.d("flippedToView: %d, isPost %s", indexInAdapter, isPost);
  358. debugBufferedViews();
  359. if (indexInAdapter >= 0 && indexInAdapter < adapterDataCount) {
  360. if (indexInAdapter == adapterIndex + 1) { //forward one page
  361. if (adapterIndex < adapterDataCount - 1) {
  362. adapterIndex++;
  363. View old = bufferedViews.get(bufferIndex);
  364. if (bufferIndex > 0)
  365. releaseView(bufferedViews.removeFirst());
  366. if (adapterIndex + sideBufferSize < adapterDataCount)
  367. bufferedViews.addLast(viewFromAdapter(adapterIndex + sideBufferSize, true));
  368. bufferIndex = bufferedViews.indexOf(old) + 1;
  369. requestLayout();
  370. updateVisibleView(inFlipAnimation ? -1 : bufferIndex);
  371. }
  372. } else if (indexInAdapter == adapterIndex - 1) {
  373. if (adapterIndex > 0) {
  374. adapterIndex--;
  375. View old = bufferedViews.get(bufferIndex);
  376. if (bufferIndex < bufferedViews.size() - 1)
  377. releaseView(bufferedViews.removeLast());
  378. if (adapterIndex - sideBufferSize >= 0)
  379. bufferedViews.addFirst(viewFromAdapter(adapterIndex - sideBufferSize, false));
  380. bufferIndex = bufferedViews.indexOf(old) - 1;
  381. requestLayout();
  382. updateVisibleView(inFlipAnimation ? -1 : bufferIndex);
  383. }
  384. } else {
  385. AphidLog.e("Should not happen: indexInAdapter %d, adapterIndex %d", indexInAdapter, adapterIndex);
  386. }
  387. } else
  388. Assert.fail("Invalid indexInAdapter: " + indexInAdapter);
  389. //debugBufferedViews();
  390. }
  391. void showFlipAnimation() {
  392. if (!inFlipAnimation) {
  393. inFlipAnimation = true;
  394. cards.setVisible(true);
  395. surfaceView.requestRender();
  396. handler.postDelayed(new Runnable() { //use a delayed message to avoid flicker, the perfect solution would be sending a message from the GL thread
  397. public void run() {
  398. if (inFlipAnimation)
  399. updateVisibleView(-1);
  400. }
  401. }, 100);
  402. }
  403. }
  404. void postHideFlipAnimation() {
  405. if (inFlipAnimation) {
  406. handler.post(new Runnable() {
  407. @Override
  408. public void run() {
  409. hideFlipAnimation();
  410. }
  411. });
  412. }
  413. }
  414. private void hideFlipAnimation() {
  415. if (inFlipAnimation) {
  416. inFlipAnimation = false;
  417. updateVisibleView(bufferIndex);
  418. if (onViewFlipListener != null)
  419. onViewFlipListener.onViewFlipped(bufferedViews.get(bufferIndex), adapterIndex);
  420. handler.post(new Runnable() {
  421. public void run() {
  422. if (!inFlipAnimation) {
  423. cards.setVisible(false);
  424. surfaceView.requestRender(); //ask OpenGL to clear its display
  425. }
  426. }
  427. });
  428. }
  429. }
  430. private void onDataChanged() {
  431. adapterDataCount = adapter.getCount();
  432. int activeIndex;
  433. if (adapterIndex < 0)
  434. activeIndex = 0;
  435. else
  436. activeIndex = Math.min(adapterIndex, adapterDataCount - 1);
  437. releaseViews();
  438. setSelection(activeIndex);
  439. }
  440. private class MyDataSetObserver extends DataSetObserver {
  441. @Override
  442. public void onChanged() {
  443. onDataChanged();
  444. }
  445. @Override
  446. public void onInvalidated() {
  447. onDataChanged();
  448. }
  449. }
  450. }
  • 效果如下:

【转】Android折叠效果实现案例的更多相关文章

  1. Android 弹幕效果开发案例

    概述 现在有个很流行的效果就是弹幕效果,满屏幕的文字从右到左飘来飘去.看的眼花缭乱,看起来还蛮cool的 现在就是来实现这一的一个效果,大部分的都是从右向左移动漂移,本文的效果中也支持从左向右的漂移移 ...

  2. Android仿掌上英雄联盟首页,实现折叠效果

    概述 仿掌上英雄联盟首页的demo 详细 代码下载:http://www.demodashi.com/demo/10695.html 首页大概分为几个部分 状态栏 标题栏 轮播图 切换的Tab 资讯列 ...

  3. 200多种Android动画效果的强悍框架

    admin 发布于2015-10-23 14:33 363/68015 [精品推荐]200多种Android动画效果的强悍框架,太全了,不看这个,再有动画的问题,不理你了^@^ 功能模块和技术方案 只 ...

  4. 【转】Material Design 折叠效果 Toolbar CollapsingToolbarLayout AppBarLayout

    我非常喜欢Material Design里折叠工具栏的效果,bilibili Android客户端视频详情页就是采用的这种设计.这篇文章的第二部分我们就通过简单的模仿bilibili视频详情页的实现来 ...

  5. Android动画效果之自定义ViewGroup添加布局动画

    前言: 前面几篇文章介绍了补间动画.逐帧动画.属性动画,大部分都是针对View来实现的动画,那么该如何为了一个ViewGroup添加动画呢?今天结合自定义ViewGroup来学习一下布局动画.本文将通 ...

  6. Android动画效果之Property Animation进阶(属性动画)

    前言: 前面初步认识了Android的Property Animation(属性动画)Android动画效果之初识Property Animation(属性动画)(三),并且利用属性动画简单了补间动画 ...

  7. Android动画效果之初识Property Animation(属性动画)

    前言: 前面两篇介绍了Android的Tween Animation(补间动画) Android动画效果之Tween Animation(补间动画).Frame Animation(逐帧动画)Andr ...

  8. Android动画效果之Frame Animation(逐帧动画)

    前言: 上一篇介绍了Android的Tween Animation(补间动画) Android动画效果之Tween Animation(补间动画),今天来总结下Android的另外一种动画Frame ...

  9. Android动画效果之Tween Animation(补间动画)

    前言: 最近公司项目下个版本迭代里面设计了很多动画效果,在以往的项目中开发中也会经常用到动画,所以在公司下个版本迭代开始之前,抽空总结一下Android动画.今天主要总结Tween Animation ...

随机推荐

  1. SCM文章4教训:定时器共阴极LED动态显示屏

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQva290ZWlfODhfbHVsdWNfNjY=/font/5a6L5L2T/fontsize/400/fil ...

  2. POJ1080 Human Gene Functions 动态规划 LCS的变形

    题意读了半年,唉,给你两串字符,然后长度不同,你能够用'-'把它们补成同样长度,补在哪里取决于得分,它会给你一个得分表,问你最大得分 跟LCS非常像的DP数组 dp[i][j]表示第一个字符串取第i个 ...

  3. Android - 建设项目的版本号

    建设项目的版本号 本文地址: http://blog.csdn.net/caroline_wendy 依据SVN中的项目, 构建本地版本号, 进行开发, 构建方式是: 1. "svn co& ...

  4. ZOJ-3652-Maze(BFS)

    Celica is a brave person and believer of a God in the bright side. He always fights against the mons ...

  5. 【iOS发展-81】setNeedsDisplay刷新显卡,并CADisplayLink它用来模拟计时器效果

    (1)效果 (2)源码下载(假设提示没有小图片的话,自己找一个替换一下即可,看到效果即可) http://download.csdn.net/detail/wsb200514/8176339 (3)总 ...

  6. obj-c编程04:类的继承

    这第4篇内容比較少,主要说的是obj-c中的类的继承,须要说明的是我仅仅是写了继承中最简单的形式,假设所有展开来说,那就多了去了!关键是如今肚子里还没装够墨水,没法展开啊! 以下的代码中,我们写了2个 ...

  7. 允许Android随着屏幕转动的控制自由转移到任何地方(附demo)

    在本文中,Android ViewGroup/View流程,及经常使用的自己定义ViewGroup的方法.在此基础上介绍动态控制View的位置的三种方法,并给出最佳的一种方法. 一.ViewGroup ...

  8. 开始折腾cocos2d-x,使用批处理来创建项目

    开始服用的时间来学习cocos2d-x该,尽管C和C++另外不咋.只是学习和记忆可能是更深层次的,现在发展: so从今天开始正式决定学会与自己的业余时间折腾吧,仅这51什么.昨天,在开发环境中建,Vi ...

  9. 网站静态化处理—web前端优化—中(12)

    网站静态化处理—web前端优化—中(12) Web前端很多优化原则都是从如何提升网络通讯效率的角度提出的,但是这些原则使用的时候还是有很多陷阱在里面,如果我们不能深入理解这些优化原则背后所隐藏的技术原 ...

  10. javascript如何解析json对javascript如何解析json对象并动态赋值到select列表象并动态赋值到select列表

    原文 javascript如何解析json对象并动态赋值到select列表 JSON(JavaScriptObject Notation)一种简单的数据格式,比xml更轻巧.JSON是JavaScri ...