首页 > 代码库 > SetResBoxState(true,true)页面弹出动画,类似抽屉效果

SetResBoxState(true,true)页面弹出动画,类似抽屉效果

/**
     * 设置装饰列表框状态
     * 
     * @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);
        }
    }


SetResBoxState(true,true)页面弹出动画,类似抽屉效果