Java tutorial
//package com.java2s; //License from project: Apache License import android.animation.ValueAnimator; import android.view.View; import android.view.ViewGroup; public class Main { public static void expand(View summary) { //set Visible summary.setVisibility(View.VISIBLE); final int widthSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); summary.measure(widthSpec, 300); ValueAnimator mAnimator = slideAnimator(0, 300, summary); mAnimator.start(); } private static ValueAnimator slideAnimator(int start, int end, final View summary) { ValueAnimator animator = ValueAnimator.ofInt(start, end); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { //Update Height int value = (Integer) valueAnimator.getAnimatedValue(); ViewGroup.LayoutParams layoutParams = summary.getLayoutParams(); layoutParams.height = value; summary.setLayoutParams(layoutParams); } }); return animator; } }