public void listViewAnimotion(final ListView listView,int animationType){ int duration = mAdapter.getCount() * 100; ValueAnimator animator = null; if(animationType == LISTVIEW_OPEN){ mLastListViewHeight = mAdapter.getCount() * AppUtils.dip2px(RechargeOneActivity.this, 41); animator = ValueAnimator.ofFloat(0, mLastListViewHeight); }else if(animationType == LISTVIEW_CLOSE){ mLastListViewHeight = mAdapter.getCount() * AppUtils.dip2px(RechargeOneActivity.this, 41); animator = ValueAnimator.ofFloat(mLastListViewHeight,0); }else if(animationType == LISTVIEW_ITEM_DELETE){ duration = 100; int curHeight = mAdapter.getCount() * AppUtils.dip2px(RechargeOneActivity.this, 41); animator = ValueAnimator.ofFloat(mLastListViewHeight, curHeight); mLastListViewHeight = curHeight; } animator.setTarget(listView); animator.setDuration(duration).start(); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { Float currentValue = (Float) animation.getAnimatedValue(); listView.getLayoutParams().height = currentValue.intValue(); listView.requestLayout(); } }); }
listview属性动画
最新推荐文章于 2019-06-12 19:37:06 发布