【开源】SmoothTransition
SmoothTransition
- https://github.com/dkmeteor/SmoothTransition
介绍:
可以让activity中view做缩放,翻转,旋转,渐变等动画效果。运行效果:
![]()
使用说明:
只需一行代码
|
1
2
3
4
5
6
|
@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new SwitchAnimationUtil().startAnimation(getWindow().getDecorView(), Constant.mType);} |
将动画效果运用在ListView中:
|
1
2
3
4
5
6
7
8
|
@Overridepublic void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (mSwitchAnimationUtil == null) { mSwitchAnimationUtil = new SwitchAnimationUtil(); mSwitchAnimationUtil.startAnimation(mList, Constant.mType); }} |
将动画效果运用在Fragment中:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
@Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mConverView = LayoutInflater.from(getActivity()).inflate(R.layout.view_fragment, null); mConverView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { new SwitchAnimationUtil().startAnimation(mConverView, Constant.mType); } }); return mConverView;} |
posted on 2015-04-13 09:27 wasdchenhao 阅读(261) 评论(0) 收藏 举报

浙公网安备 33010602011771号