private void animateView(final View target, final int type) {
		Animation anim = new ExpandCollapseAnimation(
				target,
				type
		);
		anim.setDuration(getAnimationDuration());
		anim.setAnimationListener(new AnimationListener() {

			@Override
			public void onAnimationStart(Animation animation) {}

			@Override
			public void onAnimationRepeat(Animation animation) {}

			@Override
			public void onAnimationEnd(Animation animation) {
				if (type == ExpandCollapseAnimation.EXPAND) {
					if (parent instanceof ListView) {
						ListView listView = (ListView) parent;
						int movement = target.getBottom();

						Rect r = new Rect();
						boolean visible = target.getGlobalVisibleRect(r);
						Rect r2 = new Rect();
						listView.getGlobalVisibleRect(r2);
						
						if (!visible) {
							listView.smoothScrollBy(movement, getAnimationDuration());
						} else {
							if (r2.bottom == r.bottom) {
								listView.smoothScrollBy(movement, getAnimationDuration());
							}
						}
					}
				}

			}
		});
		target.startAnimation(anim);
	}
Performs either COLLAPSE or EXPAND animation on the target view
@param target the view to animate
@param type the animation type, either ExpandCollapseAnimation.COLLAPSE
			 or ExpandCollapseAnimation.EXPAND
library/src/main/java/com/tjerkw/slideexpandable/library/AbstractSlideExpandableListAdapter.java