转换中的浅灰色屏幕

时间:2013-06-14 17:49:37

标签: android

我有两个listview,我想在某些条件usig show()和hide()方法中看到和隐藏那些listview。现在的问题是我的过渡是从上到下和从下到上的工作穿孔,但是当它开始转换它首先占用分配需要空间用于浅灰色的过渡,然后实际过渡开始。所以我如何避免分配浅灰色屏幕

public void show() {

        AnimationSet set = new AnimationSet(true);
        Animation animation = AnimationUtils.loadAnimation(getActivity(),
                R.anim.sort_slide_from_top);

        set.addAnimation(animation);

        animation.setAnimationListener(new AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
                _llyFilterList.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                _listView.setVisibility(View.INVISIBLE);
            }
        });
        _llyFilterList.startAnimation(set);

    }

    @Override
    public void hide() {
        if (_listView != null && _llyFilterList != null) {

            AnimationSet set = new AnimationSet(true);
            Animation animation = AnimationUtils.loadAnimation(getActivity(),
                    R.anim.sort_slide_from_down);

            set.addAnimation(animation);

            animation.setAnimationListener(new AnimationListener() {
                @Override
                public void onAnimationStart(Animation animation) {
                    _listView.setVisibility(View.VISIBLE);
                }

                @Override
                public void onAnimationRepeat(Animation animation) {

                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    _llyFilterList.setVisibility(View.GONE);


                }
            });
            _llyFilterList.startAnimation(set);

        }

    }

//sort_slide_from_top
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
    <translate android:fromYDelta="-100%p" android:toYDelta="0" android:duration="500" />
</set>

//sort_slide_from_down
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
    <translate android:fromYDelta="0" android:toYDelta="-100%p" android:duration="500" />
</set>

0 个答案:

没有答案