mButtonLayout = (LinearLayout) findViewById(R.id.action_btn_layout);

    private void transAnimation(boolean bool){

        AnimationSet aniInSet = new AnimationSet(true);
        AnimationSet aniOutSet = new AnimationSet(true);
        aniInSet.setInterpolator(new AccelerateInterpolator());
        Animation transInAni = new TranslateAnimation(0,0,100.0f,0);
        Animation transOutAni = new TranslateAnimation(0,0,0,100.0f);
        transInAni.setDuration(200);
        transOutAni.setDuration(200);
        aniInSet.addAnimation(transInAni);
        aniOutSet.addAnimation(transOutAni);

        if (bool) {
            mButtonLayout.setAnimation(aniInSet);
            mButtonLayout.setVisibility(View.VISIBLE);
        } else {
            mButtonLayout.setAnimation(aniOutSet);
            mButtonLayout.setVisibility(View.GONE);
        }

    }
728x90
반응형

+ Recent posts