显示动画:
mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
0.0f, Animation.RELATIVE_TO_SELF, 0.0f);
mShowAction.setDuration(500);
隐藏动画:
mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF,
0.0f, Animation.RELATIVE_TO_SELF, 1.0f,
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
0.0f);
mHiddenAction.setDuration(500);
View的显示:
mSidebarLayout.startAnimation(mShowAction);
mSidebarLayout.setVisibility(View.VISIBLE);
mSidebarHideBtn.setVisibility(View.GONE);
View的隐藏:
mSidebarLayout.startAnimation(mHiddenAction);
mSidebarLayout.setVisibility(View.GONE);
mSidebarHideBtn.setVisibility(View.VISIBLE);
动画效果:
显示时view从右边向左滑动出现;隐藏时从左向右滑动隐藏;