Umano Android SlidingUpPanel - animation

I am using the following project: https://github.com/umano/AndroidSlidingUpPanel

So far, this has worked very well, but I have one problem: I want to hide the sliding panel until I press the button, then the panel should disappear with animation; currently the panel is displayed when a button is clicked, but without animation, and I don’t know how to implement the specified animation.

Any ideas would be very welcome!

+4
source share
1 answer

I know that 4 months have passed since you asked, but I decided to send an answer anyway (so that someone might possibly benefit from it).

. AlphaAnimation , . , ,

sothree:shadowHeight="0dp"

xml.

, ( ). :

import android.view.animation.Animation;
import android.view.animation.Transformation;

import com.sothree.slidinguppanel.SlidingUpPanelLayout;

public class SlidingUpPanelResizeAnimation extends Animation {

    private SlidingUpPanelLayout mLayout;

    private float mTo;
    private float mFrom = 0;

    public SlidingUpPanelResizeAnimation(SlidingUpPanelLayout layout, float to, int duration) {
        mLayout = layout;
        mTo = to;

        setDuration(duration);
    }

    @Override
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        float dimension = (mTo - mFrom) * interpolatedTime + mFrom;

        mLayout.setPanelHeight((int) dimension);

        mLayout.requestLayout();
    }
}

:

SlidingUpPanelLayout slidingUpPanelLayout = (SlidingUpPanelLayout) findViewById(R.id.id_of_your_major_layout);

int slideablePanelHeight = 100;
int animationDuration = 800;

SlidingUpPanelResizeAnimation animation = new SlidingUpPanelResizeAnimation(slidingUpPanelLayout, slideablePanelHeight, animationDuration);
mSlidingLayout.startAnimation(animation);
+3

Source: https://habr.com/ru/post/1533196/


All Articles