安卓控件隐藏和出现动画
发表于:2024-11-25 作者:热门IT资讯网编辑
编辑最后更新 2024年11月25日,显示动画 mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, An
显示动画
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);