/** * 设置装饰列表框状态 * * @param isOpen * 是否打开 * @param hasAnimation * 打开动画 */ private void SetResBoxState(boolean isOpen, boolean hasAnimation) { page.clearAnimation(); int start; int end; if (isOpen) { page.setVisibility(View.VISIBLE); start = 1; end = 0; } else { page.setVisibility(View.GONE); start = 0; end = 1; } if (hasAnimation) { AnimationSet as; TranslateAnimation ta; as = new AnimationSet(true); ta = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, start, Animation.RELATIVE_TO_SELF, end); ta.setDuration(350); as.addAnimation(ta); page.startAnimation(as); } }
时间: 2024-10-02 19:22:53