安卓5.0系统引入了共享元素,能做出非常炫酷的场景切换效果,这让人非常兴奋同时非常蛋疼,因为低版本没法使用啊,所以今天就跟大家分享一下自己写的一个库,其实只有2个文件而已就可以兼容安卓5.0以下的版本。


重要的工具类

  1. import android.animation.Animator;
  2. import android.animation.TimeInterpolator;
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.view.View;
  6. import android.view.ViewTreeObserver;
  7.  
  8. import java.util.ArrayList;
  9.  
  10. /**
  11. * Tool for transition between two activities
  12. * <br/>
  13. * Created by huzn on 2017/5/8.
  14. */
  15. public class EasyTransition {
  16.  
  17. public static final String EASY_TRANSITION_OPTIONS = "easy_transition_options";
  18. public static final long DEFAULT_TRANSITION_ANIM_DURATION = 1000;
  19.  
  20. /**
  21. * Start Activity with transition options
  22. *
  23. * @param intent The intent to start
  24. * @param options Transition options, using {@link EasyTransitionOptions#makeTransitionOptions(Activity, View...)}
  25. * to build your options
  26. */
  27. public static void startActivity(Intent intent, EasyTransitionOptions options) {
  28. options.update();
  29. intent.putParcelableArrayListExtra(EASY_TRANSITION_OPTIONS, options.getAttrs());
  30. Activity activity = options.getActivity();
  31. activity.startActivity(intent);
  32. activity.overridePendingTransition(0, 0);
  33. }
  34.  
  35. /**
  36. * Start Activity for result, with transition options
  37. *
  38. * @param intent The intent to start
  39. * @param requestCode If >= 0, this code will be returned in onActivityResult() when the activity exits,
  40. * see {@link Activity#startActivityForResult(Intent, int)}
  41. * @param options Transition options, using {@link EasyTransitionOptions#makeTransitionOptions(Activity, View...)}
  42. * to build your options
  43. */
  44. public static void startActivityForResult(Intent intent, int requestCode, EasyTransitionOptions options) {
  45. options.update();
  46. intent.putParcelableArrayListExtra(EASY_TRANSITION_OPTIONS, options.getAttrs());
  47. Activity activity = options.getActivity();
  48. activity.startActivityForResult(intent, requestCode);
  49. activity.overridePendingTransition(0, 0);
  50. }
  51.  
  52. /**
  53. * Enter the Activity, invoking this method to start enter transition animations
  54. *
  55. * @param activity The Activity entering
  56. * @param duration The duration of enter transition animation
  57. * @param interpolator The TimeInterpolator of enter transition animation
  58. * @param listener Animator listener, normally you can do your initial after animation end
  59. */
  60. public static void enter(Activity activity, long duration, TimeInterpolator interpolator, Animator.AnimatorListener listener) {
  61. Intent intent = activity.getIntent();
  62. ArrayList<EasyTransitionOptions.ViewAttrs> attrs =
  63. intent.getParcelableArrayListExtra(EASY_TRANSITION_OPTIONS);
  64. runEnterAnimation(activity, attrs, duration, interpolator, listener);
  65. }
  66.  
  67. /**
  68. * The same as {@link EasyTransition#enter(Activity, long, TimeInterpolator, Animator.AnimatorListener)}
  69. * with no interpolator
  70. */
  71. public static void enter(Activity activity, long duration, Animator.AnimatorListener listener) {
  72. enter(activity, duration, null, listener);
  73. }
  74.  
  75. /**
  76. * The same as {@link EasyTransition#enter(Activity, long, TimeInterpolator, Animator.AnimatorListener)}
  77. * with default duration
  78. */
  79. public static void enter(Activity activity, TimeInterpolator interpolator, Animator.AnimatorListener listener) {
  80. enter(activity, DEFAULT_TRANSITION_ANIM_DURATION, interpolator, listener);
  81. }
  82.  
  83. /**
  84. * The same as {@link EasyTransition#enter(Activity, long, TimeInterpolator, Animator.AnimatorListener)}
  85. * with default duration and no interpolator
  86. */
  87. public static void enter(Activity activity, Animator.AnimatorListener listener) {
  88. enter(activity, DEFAULT_TRANSITION_ANIM_DURATION, null, listener);
  89. }
  90.  
  91. /**
  92. * The same as {@link EasyTransition#enter(Activity, long, TimeInterpolator, Animator.AnimatorListener)}
  93. * with default duration, no interpolator and no listener
  94. */
  95. public static void enter(Activity activity) {
  96. enter(activity, DEFAULT_TRANSITION_ANIM_DURATION, null, null);
  97. }
  98.  
  99. private static void runEnterAnimation(Activity activity,
  100. ArrayList<EasyTransitionOptions.ViewAttrs> attrs,
  101. final long duration,
  102. final TimeInterpolator interpolator,
  103. final Animator.AnimatorListener listener) {
  104. if (null == attrs || attrs.size() == 0)
  105. return;
  106.  
  107. for (final EasyTransitionOptions.ViewAttrs attr : attrs) {
  108. final View view = activity.findViewById(attr.id);
  109.  
  110. if (null == view)
  111. continue;
  112.  
  113. view.getViewTreeObserver()
  114. .addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
  115. @Override
  116. public boolean onPreDraw() {
  117. view.getViewTreeObserver().removeOnPreDrawListener(this);
  118.  
  119. int[] location = new int[2];
  120. view.getLocationOnScreen(location);
  121. view.setPivotX(0);
  122. view.setPivotY(0);
  123. view.setScaleX(attr.width / view.getWidth());
  124. view.setScaleY(attr.height / view.getHeight());
  125. view.setTranslationX(attr.startX - location[0]); // xDelta
  126. view.setTranslationY(attr.startY - location[1]); // yDelta
  127.  
  128. view.animate()
  129. .scaleX(1)
  130. .scaleY(1)
  131. .translationX(0)
  132. .translationY(0)
  133. .setDuration(duration)
  134. .setInterpolator(interpolator)
  135. .setListener(listener);
  136. return true;
  137. }
  138. });
  139. }
  140. }
  141.  
  142. /**
  143. * Exit the Activity, invoke this method to start exit transition animation,
  144. * the shared views must have same ids, or it will throws NullPointerException
  145. *
  146. * @param activity The Activity Exiting
  147. * @param interpolator The TimeInterpolator of exit transition animation
  148. * @param duration The duration of exit transition animation
  149. * @throws NullPointerException throws if shared views not found in The Activity Exiting
  150. */
  151. public static void exit(Activity activity, long duration, TimeInterpolator interpolator) {
  152. Intent intent = activity.getIntent();
  153. ArrayList<EasyTransitionOptions.ViewAttrs> attrs = intent.getParcelableArrayListExtra(EASY_TRANSITION_OPTIONS);
  154. runExitAnimation(activity, attrs, duration, interpolator);
  155. }
  156.  
  157. /**
  158. * The same as {@link EasyTransition#exit(Activity, long, TimeInterpolator)}
  159. * with default duration
  160. */
  161. public static void exit(Activity activity, TimeInterpolator interpolator) {
  162. exit(activity, DEFAULT_TRANSITION_ANIM_DURATION, interpolator);
  163. }
  164.  
  165. /**
  166. * The same as {@link EasyTransition#exit(Activity, long, TimeInterpolator)}
  167. * with no interpolator
  168. */
  169. public static void exit(Activity activity, long duration) {
  170. exit(activity, duration, null);
  171. }
  172.  
  173. /**
  174. * The same as {@link EasyTransition#exit(Activity, long, TimeInterpolator)}
  175. * with default duration and no interpolator
  176. */
  177. public static void exit(Activity activity) {
  178. exit(activity, DEFAULT_TRANSITION_ANIM_DURATION, null);
  179. }
  180.  
  181. private static void runExitAnimation(final Activity activity,
  182. ArrayList<EasyTransitionOptions.ViewAttrs> attrs,
  183. long duration,
  184. TimeInterpolator interpolator) {
  185. if (null == attrs || attrs.size() == 0)
  186. return;
  187.  
  188. for (final EasyTransitionOptions.ViewAttrs attr : attrs) {
  189. View view = activity.findViewById(attr.id);
  190. int[] location = new int[2];
  191. view.getLocationOnScreen(location);
  192. view.setPivotX(0);
  193. view.setPivotY(0);
  194.  
  195. view.animate()
  196. .scaleX(attr.width / view.getWidth())
  197. .scaleY(attr.height / view.getHeight())
  198. .translationX(attr.startX - location[0])
  199. .translationY(attr.startY - location[1])
  200. .setInterpolator(interpolator)
  201. .setDuration(duration);
  202. }
  203.  
  204. activity.findViewById(attrs.get(0).id).postDelayed(new Runnable() {
  205. @Override
  206. public void run() {
  207. activity.finish();
  208. activity.overridePendingTransition(0, 0);
  209. }
  210. }, duration);
  211. }
  212. }
  1. import android.app.Activity;
  2. import android.os.Parcel;
  3. import android.os.Parcelable;
  4. import android.view.View;
  5.  
  6. import java.util.ArrayList;
  7.  
  8. /**
  9. * Transition options, using {@link EasyTransitionOptions#makeTransitionOptions(Activity, View...)}
  10. * to build your options
  11. * <br/>
  12. * Created by huzn on 2017/5/8.
  13. */
  14. public class EasyTransitionOptions {
  15.  
  16. private Activity activity;
  17. private View[] views;
  18. private ArrayList<ViewAttrs> attrs;
  19.  
  20. public EasyTransitionOptions(Activity activity, View[] views) {
  21. this.activity = activity;
  22. this.views = views;
  23. }
  24.  
  25. /**
  26. * Make options for transition
  27. *
  28. * @param activity The activity who contains shared views
  29. * @param views Shared views, which must contains same id between two activities
  30. * @return A new transition options that will be used to build our transition animations
  31. */
  32. public static EasyTransitionOptions makeTransitionOptions(Activity activity, View... views) {
  33. return new EasyTransitionOptions(activity, views);
  34. }
  35.  
  36. public void update() {
  37. if (null == views)
  38. return;
  39.  
  40. attrs = new ArrayList<>();
  41. for (View v : views) {
  42. int[] location = new int[2];
  43. v.getLocationOnScreen(location);
  44. attrs.add(new ViewAttrs(
  45. v.getId(),
  46. location[0],
  47. location[1],
  48. v.getWidth(),
  49. v.getHeight()
  50. ));
  51. }
  52. }
  53.  
  54. public Activity getActivity() {
  55. return activity;
  56. }
  57.  
  58. public ArrayList<ViewAttrs> getAttrs() {
  59. return attrs;
  60. }
  61.  
  62. public static class ViewAttrs implements Parcelable {
  63. public int id;
  64. public float startX;
  65. public float startY;
  66. public float width;
  67. public float height;
  68.  
  69. public ViewAttrs(int id, float startX, float startY, float width, float height) {
  70. this.id = id;
  71. this.startX = startX;
  72. this.startY = startY;
  73. this.width = width;
  74. this.height = height;
  75. }
  76.  
  77. // Parcelable
  78. @Override
  79. public int describeContents() {
  80. return 0;
  81. }
  82.  
  83. @Override
  84. public void writeToParcel(Parcel dest, int flags) {
  85. dest.writeInt(this.id);
  86. dest.writeFloat(this.startX);
  87. dest.writeFloat(this.startY);
  88. dest.writeFloat(this.width);
  89. dest.writeFloat(this.height);
  90. }
  91.  
  92. protected ViewAttrs(Parcel in) {
  93. this.id = in.readInt();
  94. this.startX = in.readFloat();
  95. this.startY = in.readFloat();
  96. this.width = in.readFloat();
  97. this.height = in.readFloat();
  98. }
  99.  
  100. public static final Parcelable.Creator<ViewAttrs> CREATOR = new Parcelable.Creator<ViewAttrs>() {
  101. @Override
  102. public ViewAttrs createFromParcel(Parcel source) {
  103. return new ViewAttrs(source);
  104. }
  105.  
  106. @Override
  107. public ViewAttrs[] newArray(int size) {
  108. return new ViewAttrs[size];
  109. }
  110. };
  111. }
  112. }

场景使用:

  1. import android.content.Intent;
  2. import android.os.Bundle;
  3. import android.support.v7.app.AppCompatActivity;
  4. import android.view.LayoutInflater;
  5. import android.view.View;
  6. import android.view.ViewGroup;
  7. import android.widget.AdapterView;
  8. import android.widget.BaseAdapter;
  9. import android.widget.ListView;
  10. import android.widget.TextView;
  11.  
  12. import java.util.ArrayList;
  13.  
  14. public class MainActivity extends AppCompatActivity {
  15.  
  16. private ArrayList<String> list;
  17.  
  18. @Override
  19. protected void onCreate(Bundle savedInstanceState) {
  20. super.onCreate(savedInstanceState);
  21. setContentView(R.layout.activity_main);
  22.  
  23. list = new ArrayList<>();
  24. for (int i = 0; i < 20; i++) {
  25. list.add("name" + i);
  26. }
  27. ListView listView = (ListView) findViewById(R.id.lv);
  28. listView.setAdapter(new MyAdapter());
  29. listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  30. @Override
  31. public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  32. // ready for intent
  33. Intent intent = new Intent(MainActivity.this, DetailActivity.class);
  34. intent.putExtra("name", list.get(position));
  35.  
  36. // ready for transition options
  37. EasyTransitionOptions options =
  38. EasyTransitionOptions.makeTransitionOptions(
  39. MainActivity.this,
  40. view.findViewById(R.id.iv_icon),
  41. view.findViewById(R.id.tv_name),
  42. findViewById(R.id.v_top_card));
  43.  
  44. // start transition
  45. EasyTransition.startActivity(intent, options);
  46. }
  47. });
  48. }
  49.  
  50. private class MyAdapter extends BaseAdapter {
  51.  
  52. @Override
  53. public int getCount() {
  54. int count = 0;
  55. if (null != list)
  56. count = list.size();
  57. return count;
  58. }
  59.  
  60. @Override
  61. public Object getItem(int position) {
  62. return list.get(position);
  63. }
  64.  
  65. @Override
  66. public long getItemId(int position) {
  67. return position;
  68. }
  69.  
  70. @Override
  71. public View getView(int position, View convertView, ViewGroup parent) {
  72. View view = null;
  73. if (null != convertView) {
  74. view = convertView;
  75. } else {
  76. view = LayoutInflater.from(MainActivity.this).inflate(R.layout.item_main_list, null, false);
  77. }
  78. TextView tvName = (TextView) view.findViewById(R.id.tv_name);
  79. tvName.setText(list.get(position));
  80. return view;
  81. }
  82. }
  83. }
  1. import android.animation.Animator;
  2. import android.animation.AnimatorListenerAdapter;
  3. import android.os.Bundle;
  4. import android.support.annotation.Nullable;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.view.MotionEvent;
  7. import android.view.View;
  8. import android.view.animation.DecelerateInterpolator;
  9. import android.widget.ImageView;
  10. import android.widget.LinearLayout;
  11. import android.widget.ScrollView;
  12. import android.widget.TextView;
  13.  
  14. public class DetailActivity extends AppCompatActivity {
  15.  
  16. private LinearLayout layoutAbout;
  17. private ImageView ivAdd;
  18. private boolean finishEnter;
  19.  
  20. @Override
  21. protected void onCreate(@Nullable Bundle savedInstanceState) {
  22. super.onCreate(savedInstanceState);
  23. setContentView(R.layout.activity_detail);
  24.  
  25. // pre init some views and data
  26. initViews();
  27.  
  28. // if re-initialized, do not play any anim
  29. long transitionDuration = 800;
  30. if (null != savedInstanceState)
  31. transitionDuration = 0;
  32.  
  33. // transition enter
  34. finishEnter = false;
  35. EasyTransition.enter(
  36. this,
  37. transitionDuration,
  38. new DecelerateInterpolator(),
  39. new AnimatorListenerAdapter() {
  40. @Override
  41. public void onAnimationEnd(Animator animation) {
  42. // init other views after transition anim
  43. finishEnter = true;
  44. initOtherViews();
  45. }
  46. });
  47. }
  48.  
  49. private void initViews() {
  50. TextView tvName = (TextView) findViewById(R.id.tv_name);
  51. tvName.setText(getIntent().getStringExtra("name"));
  52. }
  53.  
  54. private void initOtherViews() {
  55. layoutAbout = (LinearLayout) findViewById(R.id.layout_about);
  56. layoutAbout.setVisibility(View.VISIBLE);
  57. layoutAbout.setAlpha(0);
  58. layoutAbout.setTranslationY(-30);
  59. layoutAbout.animate()
  60. .setDuration(300)
  61. .alpha(1)
  62. .translationY(0);
  63.  
  64. ivAdd = (ImageView) findViewById(R.id.iv_add);
  65. ivAdd.setVisibility(View.VISIBLE);
  66. ivAdd.setScaleX(0);
  67. ivAdd.setScaleY(0);
  68. ivAdd.animate()
  69. .setDuration(200)
  70. .scaleX(1)
  71. .scaleY(1);
  72. }
  73.  
  74. @Override
  75. public void onBackPressed() {
  76. if (finishEnter) {
  77. finishEnter = false;
  78. startBackAnim();
  79. }
  80. }
  81.  
  82. private void startBackAnim() {
  83. // forbidden scrolling
  84. ScrollView sv = (ScrollView) findViewById(R.id.sv);
  85. sv.setOnTouchListener(new View.OnTouchListener() {
  86. @Override
  87. public boolean onTouch(View v, MotionEvent event) {
  88. return true;
  89. }
  90. });
  91.  
  92. // start our anim
  93. ivAdd.animate()
  94. .setDuration(200)
  95. .scaleX(0)
  96. .scaleY(0);
  97.  
  98. layoutAbout.animate()
  99. .setDuration(300)
  100. .alpha(0)
  101. .translationY(-30)
  102. .setListener(new AnimatorListenerAdapter() {
  103. @Override
  104. public void onAnimationEnd(Animator animation) {
  105. // transition exit after our anim
  106. EasyTransition.exit(DetailActivity.this, 800, new DecelerateInterpolator());
  107. }
  108. });
  109. }
  110. }

activity_main.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout
  3. xmlns:android="http://schemas.android.com/apk/res/android"
  4. xmlns:tools="http://schemas.android.com/tools"
  5. android:layout_width="match_parent"
  6. android:layout_height="match_parent"
  7. tools:context="com.hzn.easytransition.MainActivity"
  8. >
  9.  
  10. <TextView
  11. android:id="@+id/title_bar"
  12. android:layout_width="match_parent"
  13. android:layout_height="55dp"
  14. android:background="@color/colorPrimary"
  15. android:gravity="center_vertical"
  16. android:paddingLeft="16sp"
  17. android:text="TITLE"
  18. android:textColor="#ffffff"
  19. android:textSize="25sp"
  20. />
  21.  
  22. <View
  23. android:id="@+id/v_top_card"
  24. android:layout_width="match_parent"
  25. android:layout_height="0dp"
  26. android:layout_below="@id/title_bar"
  27. android:background="@color/colorPrimary"
  28. />
  29.  
  30. <ListView
  31. android:id="@+id/lv"
  32. android:layout_width="match_parent"
  33. android:layout_height="match_parent"
  34. android:layout_below="@id/title_bar"
  35. />
  36. </RelativeLayout>

activity_detail.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout
  3. xmlns:android="http://schemas.android.com/apk/res/android"
  4. xmlns:tools="http://schemas.android.com/tools"
  5. android:layout_width="match_parent"
  6. android:layout_height="match_parent"
  7. tools:context="com.hzn.easytransition.MainActivity"
  8. >
  9.  
  10. <TextView
  11. android:id="@+id/title_bar"
  12. android:layout_width="match_parent"
  13. android:layout_height="55dp"
  14. android:background="@color/colorPrimary"
  15. android:gravity="center_vertical"
  16. android:paddingLeft="16sp"
  17. android:text="TITLE"
  18. android:textColor="#ffffff"
  19. android:textSize="25sp"
  20. />
  21.  
  22. <View
  23. android:id="@+id/v_top_card"
  24. android:layout_width="match_parent"
  25. android:layout_height="120dp"
  26. android:layout_below="@+id/title_bar"
  27. android:background="@color/colorPrimary"
  28. />
  29.  
  30. <ImageView
  31. android:id="@+id/iv_icon"
  32. android:layout_width="150dp"
  33. android:layout_height="150dp"
  34. android:layout_centerHorizontal="true"
  35. android:layout_marginTop="100dp"
  36. android:src="@mipmap/avatar_male"
  37. />
  38.  
  39. <TextView
  40. android:id="@+id/tv_name"
  41. android:layout_width="wrap_content"
  42. android:layout_height="wrap_content"
  43. android:layout_below="@+id/iv_icon"
  44. android:layout_centerHorizontal="true"
  45. android:layout_marginLeft="10dp"
  46. android:textColor="#5b5b5b"
  47. android:textSize="50sp"
  48. />
  49.  
  50. <ScrollView
  51. android:id="@+id/sv"
  52. android:layout_width="match_parent"
  53. android:layout_height="match_parent"
  54. android:layout_below="@+id/tv_name"
  55. android:overScrollMode="never"
  56. android:scrollbars="none"
  57. >
  58.  
  59. <LinearLayout
  60. android:id="@+id/layout_about"
  61. android:layout_width="match_parent"
  62. android:layout_height="wrap_content"
  63. android:layout_marginLeft="16dp"
  64. android:layout_marginRight="16dp"
  65. android:orientation="vertical"
  66. android:paddingBottom="40dp"
  67. android:paddingTop="20dp"
  68. android:visibility="invisible"
  69. >
  70.  
  71. <TextView
  72. android:layout_width="match_parent"
  73. android:layout_height="wrap_content"
  74. android:drawableLeft="@mipmap/icon_phone"
  75. android:drawablePadding="10dp"
  76. android:gravity="center_vertical"
  77. android:text="151-2121-2121"
  78. android:textColor="#446880"
  79. android:textSize="16sp"
  80. />
  81.  
  82. <TextView
  83. android:layout_width="match_parent"
  84. android:layout_height="wrap_content"
  85. android:layout_marginTop="16dp"
  86. android:drawableLeft="@mipmap/icon_email"
  87. android:drawablePadding="10dp"
  88. android:gravity="center_vertical"
  89. android:text="243666666@gmail.com"
  90. android:textColor="#446880"
  91. android:textSize="16sp"
  92. />
  93.  
  94. <TextView
  95. android:layout_width="match_parent"
  96. android:layout_height="wrap_content"
  97. android:layout_marginTop="16dp"
  98. android:drawableLeft="@mipmap/icon_location"
  99. android:drawablePadding="10dp"
  100. android:gravity="center_vertical"
  101. android:text="China, Guangdong, Shenzhen"
  102. android:textColor="#446880"
  103. android:textSize="16sp"
  104. />
  105. </LinearLayout>
  106. </ScrollView>
  107.  
  108. <ImageView
  109. android:id="@+id/iv_add"
  110. android:layout_width="wrap_content"
  111. android:layout_height="wrap_content"
  112. android:layout_alignParentBottom="true"
  113. android:layout_alignParentRight="true"
  114. android:padding="16dp"
  115. android:src="@mipmap/icon_add"
  116. android:visibility="gone"
  117. />
  118. </RelativeLayout>

item_main_list.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"
  5. android:orientation="vertical"
  6. android:padding="16dp"
  7. >
  8.  
  9. <ImageView
  10. android:id="@+id/iv_icon"
  11. android:layout_width="50dp"
  12. android:layout_height="50dp"
  13. android:src="@mipmap/avatar_male"
  14. />
  15.  
  16. <TextView
  17. android:id="@+id/tv_name"
  18. android:layout_width="wrap_content"
  19. android:layout_height="wrap_content"
  20. android:layout_marginLeft="10dp"
  21. android:layout_toRightOf="@+id/iv_icon"
  22. android:text="name"
  23. android:textColor="#5b5b5b"
  24. android:textSize="20sp"
  25. />
  26.  
  27. </RelativeLayout>

效果图:


学习来源:http://blog.csdn.net/u012199331/article/details/72137112


  1.  

Android共享元素场景切换动画的实现的更多相关文章

  1. Android的Activity屏幕切换动画(一)-左右滑动切换

    (国内知名Android开发论坛eoe开发者社区推荐:http://www.eoeandroid.com/) Android的Activity屏幕切换动画(一)-左右滑动切换 在Android开发过程 ...

  2. IOS自定义场景切换动画。

    IOS中我们可以通过Storyborad以及segue来实现我们自己的场景切换动画,新建项目使用Single View Application模板并取名为MyCustomSegue. 使用storyb ...

  3. cocos2d-x场景切换动画

    void StartScene::beginGame() {     CCLog("beginGame");          //CCTransitionScene *trans ...

  4. Android的Activity屏幕切换动画-左右滑动切换

    . --> 在Android开发过程中,经常会碰到Activity之间的切换效果的问题,下面介绍一下如何实现左右滑动的切换效果,首先了解一下Activity切换的实现,从Android2.0开始 ...

  5. Android为ViewPager增加切换动画——使用属性动画.

    ViewPager作为Android最常用的的组件之一,相信大家在项目中会频繁的使用到的,例如利用ViewPager制作引导页.轮播图,甚至做整个app的表现层的框架等等. Android3.0以下不 ...

  6. Android开发中activity切换动画的实现

    (1)我们在MainAcitvity中定义两个textview,用于点击触发切换Activity事件,下面是布局文件代码. <LinearLayout android:layout_width= ...

  7. Android至ViewPager添加切换动画——使用属性动画

    转载请注明出处:http://blog.csdn.net/allen315410/article/details/44200623 ViewPager作为Android最经常使用的的组件之中的一个.相 ...

  8. Android为ViewPager添加切换动画——自己定义ViewPager

    转载请注明出处:http://blog.csdn.net/allen315410/article/details/44224517 在上篇博客中,我写了一个使用属性动画为ViewPager加入切换动画 ...

  9. cocos2dx常见场景切换动画(转)

    本文转载自:http://www.cnblogs.com/linux-ios/archive/2013/04/09/3010779.html bool HelloWorld::init() { /// ...

随机推荐

  1. docker 网络 实现

    最近在学习docker网络相关的知识,关于网络这块儿记下来,以便review dokcer安装完成之后默认提供三种网络  bridge host none  docker默认使用bridge brid ...

  2. ValueError: day is out of range for month

    日期超出范围. 我当时使用datetime模块生成时间格式数据,手误传错参数导致的结果.所以,好好检查数据就可解决问题. 如下: # 将字符串类型数据转化成时间结构数据# 原想写成如下代码import ...

  3. typedef 返回类型(*Function)(参数表) ——typedef函数指针

    //首先看一下函数指针怎么用 #include <iostream> using namespace std; //定义一个函数指针pFUN,它指向一个返回类型为char,有一个整型的参数 ...

  4. Jmeter多接口测试之参数传递

    接口测试包含单接口测试和多接口测试,通过组合多个接口实现一组功能的验证称为多接口测试,单接口重在单个接口多种请求组合的响应断言,多接口重在组合不同接口,实现流程的串联和验证.多接口测试涉及到接口之间参 ...

  5. Memcached快速入门

    1.基本概念 基于高性能的key-value的内存数据库.单进程多线程,协议简单,使用文本行的协议,支持数据类型简单,不支持持久化,轻量级锁CAS机制,集群互不通信,缓存策略(LRU,FIFO,LFU ...

  6. debug --- 使用Eclipse

    debug必知(快捷键若无效,有可能是与其它软件的快捷键发生冲突的原因) 1.F6  ——  单步执行代码,即顺序一行行地执行源码 2.F5  ——  跳入当前调用的函数的内部,即进入函数内部执行源码 ...

  7. 高可用,多路冗余GFS2集群文件系统搭建详解

    高可用,多路冗余GFS2集群文件系统搭建详解 2014.06 标签:GFS2 multipath 集群文件系统 cmirror 实验拓扑图: 实验原理: 实验目的:通过RHCS集群套件搭建GFS2集群 ...

  8. react浏览器回退按钮的时候传递参数

    本来是有这个需求的,但是后来发现回退不也是到某个页面吗?接下来就使用了redux,真香啊,不管用户怎么操作,你到这个界面都给他一个值就完事了,没有就不给他这个值. 哈哈哈,公司框架使用umi.上代码 ...

  9. Centos7——docker入门(笔记)

    docker 入门(笔记) 一.Docker是什么? 官方原话: Docker provides a way to run applications securely isolated in a co ...

  10. LINUX笔记之二常用命令(文件处理命令)

    一.概述 1. “.”开头的文件是隐藏文件,大小写敏感是因为用C语言编写 2. DOS中 cd..可回到父目录 在LINUX中要用cd ..(用空格) 3. 4.LINUX命令有两种:仅root可执行 ...