简体   繁体   English

像Android导航抽屉一样的Android平滑翻译动画

[英]Android smooth translation animation like android navigation drawer

I have a linearlayout which I want to slide in from right to left on the press of a button. 我有一个线性布局,我想按一下按钮从右向左滑动。 I want to achieve animation like that of usual navigation drawer, smooth and swift. 我想获得像通常的导航抽屉一样的动画效果,流畅流畅。

I have used following xml 我已经使用以下xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="400"
android:fromXDelta="-100%"
android:toXDelta="0%"
android:interpolator="@android:anim/decelerate_interpolator"
/>

But the animation is not smooth and more jumpy to say. 但是动画并不流畅,说起来也更容易。 Can anyone guide, what would be the basics if I have to achieve animation like that of navigation drawer. 任何人都可以指导,如果我必须实现类似于导航抽屉那样的动画,将会有什么基础知识。

Try to increase the duration. 尝试增加持续时间。 ie

 android:duration="800"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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