简体   繁体   中英

Android slide out animation , space left is filled by other view

using sdk 2.3

I have a view at the bottom of the screen that I want to slide out so I use this code

       FrameLayout ll1 = (FrameLayout) findViewById(R.id.bottom_panel);
        Animation anim1 = AnimationUtils.loadAnimation(this, R.anim.slideoutbottom);
        anim1.setInterpolator((new  
                   AccelerateDecelerateInterpolator()));
        anim.setFillAfter(true);
        ll1.setAnimation(anim1);
        ll1.setVisibility(View.GONE);

xml:

       <?xml version="1.0" encoding="utf-8"?>
       <set xmlns:android="http://schemas.android.com/apk/res/android">
       <translate android:fromYDelta="0%p" android:toYDelta="45%p"          android:duration="500" android:zAdjustment="bottom"/>
       </set>

THe problem I have is that there is a view in the middle of the screen which is expanding to fill the space left by the view sliding out. I don't want this to happen, I just need the view in the middle to stay where it is and I will fade this one out.

How to solve Thanks

Instead of setting the visibility to View.GONE , use View.INVISIBLE .

In that way, the view you slide out will remain occupying the space on the screen.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM