安卓控件隐藏和出现动画

显示动画



 mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,   
                    Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,   
                    -1.0f, Animation.RELATIVE_TO_SELF, 0.0f);   
            mShowAction.setDuration(500);



隐藏动画


mHiddenAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF,   
                    0.0f, Animation.RELATIVE_TO_SELF, 0.0f,   
                    Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,   
                    1.0f);  
 mHiddenAction.setDuration(500);




View的显示:


 view.startAnimation(mShowAction);   
 view.setVisibility(View.VISIBLE);


View的隐藏:



view.startAnimation(mHiddenAction);   
view.setVisibility(View.GONE);


你可能感兴趣的:(动画,安卓,空间隐藏)