MSaudi
MSaudi

Reputation: 4652

Panel that slide from top to bottom Android

I want to implement sliding panel that slide on touch from top to bottom in Android like this design

enter image description here

enter image description here

Upvotes: 4

Views: 2102

Answers (2)

Sharmilee
Sharmilee

Reputation: 1295

You can also implement same via Translate Animation. First you need to write xml file under res/anim folder.

slide_down_service.xml 
<translate 
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:duration="@android:integer/config_longAnimTime" 
      android:fromXDelta="0%p" 
      android:toXDelta="0%p"
      android:fromYDelta="0%"
      android:toYDelta="120%">
</translate>

you can change YDelta value as per requirement. Then you need to intialize Animations in following way in your activity.

  Animation animContentDown = AnimationUtils.loadAnimation(
                    getApplicationContext(), R.anim.slide_down_service);
            animContentDown.setAnimationListener(new AnimationListener() {
                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }

                @Override
                public void onAnimationEnd(Animation animation) {

                }
            });

And then start your animation : yourview.startAnimation(animContentDown);

Upvotes: 3

nerdyaswild
nerdyaswild

Reputation: 122

That's a sliding drawer. Implementation is easy, you just need the two views for the handle and the content. Be careful though, it has been deprecated.

Upvotes: 0

Related Questions