赞
踩
1.将drawerlayout 的shadow (阴影去掉)
drawerlayout.setScrimColor(Color.TRANSPARENT);
2.修改动画
原动画是通过viewdraghelper-scroller 来实现的 时间 = 距离/速度;
如果要改原本的动画 要重写 ViewDragCallback 自己替换里面drager
我是直接通过listener 来改的
- public class CustomDrawerListener implements VerticalDrawerLayout.VerticalDrawerListener {
- @Override
- public void onVerticalDrawerSlide(View drawerView, float slideOffset) {
- animZoom(drawerView, slideOffset);
- }
-
- @Override
- public void onVerticalDrawerOpened(View drawerView) {
-
- }
-
- @Override
- public void onVerticalDrawerClosed(View drawerView) {
-
- }
-
- @Override
- public void onVerticalDrawerStateChanged(int newState) {
-
- }
-
- private void animStandup(View target, float slideOffset) {
- float x = (target.getWidth() - target.getPaddingLeft() - target.getPaddingRight()) / 2
- + target.getPaddingLeft();
- float y = target.getHeight() - target.getPaddingBottom();
- target.setPivotX(x);
- target.setPivotY(y);
- target.setRotationX(90 * (1 - slideOffset));
- }
-
- private void animZoom(View target, float slideOffset) {
- target.setPivotX(0);
- target.setPivotY(target.getPaddingBottom());
- target.setScaleX(slideOffset);
- target.setScaleY(slideOffset);
- target.setAlpha(slideOffset * 255);
- target.setTranslationY(slideOffset);
- }
- }
直接实现drawelistener在scroller平移的同时添加了其他属性的变化
3.属性动画用不明白的第三方动画库 看看里面已有的动画会有很多启发
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。