SmoothTransition
介绍:
可以让activity中view做缩放,翻转,旋转,渐变等动画效果。
运行效果:
使用说明:
只需一行代码
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new SwitchAnimationUtil().startAnimation(getWindow().getDecorView(), Constant.mType);
}
将动画效果运用在ListView中:
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (mSwitchAnimationUtil == null) {
mSwitchAnimationUtil = new SwitchAnimationUtil();
mSwitchAnimationUtil.startAnimation(mList, Constant.mType);
}
}
将动画效果运用在Fragment中:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public 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;
}
已下载
0