Reputation: 4652
I want to implement sliding panel that slide on touch from top to bottom in Android like this design
Upvotes: 4
Views: 2102
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
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