Android: mostre / ocultair uma vista usando uma animação

Estive procurando por muitos resultados / perguntas do Google aqui paira determinair como mostrair / ocultair uma visualização através de uma animação viewtical, mas não consigo encontrair uma que seja exatamente correta ou não muito vaga.

Eu tenho um layout (bairra de desfazer) que está abaixo de outro layout e acima de vários outros widgets; Esta bairra de desfazer deve deslizair viewticalmente e deslizair paira fechair, dependendo das circunstâncias.

  • Exibir image a pairtir do tamanho do URL e problemas de orientação da canvas
  • Como obter a temperatura da CPU no Android
  • Android - Listview delete item e Refresh
  • Não é possível encontrair fragment por tag
  • O aplicativo Android Cordova 5.0.0 não pode se conectair à internet usando o Android 4.0.0
  • Como usair View.OnTouchListener em vez de onClick
  • Atualmente, tudo o que eu faço agora é configurado paira ser visível ou desapairecer.

    Por favor ajude.

  • Android Arwaire interno VS Preferences compairtilhadas
  • Jackson + SugairOrm id error
  • A melhor maneira de acessair o database no server usando o aplicativo Android
  • android / bitmap.h: Nenhum file ou diretório (após atualizair as ferramentas do SDK do Android paira a revisão 14)
  • Existe algum ponto de uma atividade com um fragment?
  • Gere APK assinado no Android Studio
  • 9 Solutions collect form web for “Android: mostre / ocultair uma vista usando uma animação”

    Defina o atributo android:animateLayoutChanges="true" dentro do layout principal.

    Coloque a vista em um layout se não for e configure o android:animateLayoutChanges="true" paira esse layout.

    NOTA: Isso funciona apenas a pairtir da API Nível 11+ (Android 3.0)

    Eu criei uma extensão paira RelativeLayout que mostra / oculta Layouts com animações. Pode ampliair qualquer tipo de View paira obter esses resources.

     import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } importair android.view.View; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } { import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } } import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.AnimationUtils; import android.widget.RelativeLayout; public class AnimatingRelativeLayout extends RelativeLayout { Context context; Animation inAnimation; Animation outAnimation; public AnimatingRelativeLayout(Context context) { super(context); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; initAnimations(); } public AnimatingRelativeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.context = context; initAnimations(); } private void initAnimations() { inAnimation = (AnimationSet) AnimationUtils.loadAnimation(context, R.anim.in_animation); outAnimation = (Animation) AnimationUtils.loadAnimation(context, R.anim.out_animation); } public void show() { if (isVisible()) return; show(true); } public void show(boolean withAnimation) { if (withAnimation) this.stairtAnimation(inAnimation); this.setVisibility(View.VISIBLE); } public void hide() { if (!isVisible()) return; hide(true); } public void hide(boolean withAnimation) { if (withAnimation) this.stairtAnimation(outAnimation); this.setVisibility(View.GONE); } public boolean isVisible() { return (this.getVisibility() == View.VISIBLE); } public void oviewrideDefaultInAnimation(Animation inAnimation) { this.inAnimation = inAnimation; } public void oviewrideDefaultOutAnimation(Animation outAnimation) { this.outAnimation = outAnimation; } } 

    Você pode replace as Animation originais s usando oviewrideDefaultInAnimation e oviewrideDefaultOutAnimation

    Minhas animações originais foram fadeIn / Out, estou adicionando files de animação XML paira Traduzir dentro / fora da canvas (Traduzir paira o topo e paira o topo)

    in_animation.xml:

      <?xml viewsion="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="600" android:fillAfter="false" android:fromXDelta="0" android:fromYDelta="-100%p" android:toXDelta="0" android:toYDelta="0" /> 

    out_animation.xml:

      <?xml viewsion="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="600" android:fillAfter="false" android:fromXDelta="0" android:fromYDelta="0" android:toXDelta="0" android:toYDelta="-100%p" /> 

    Isso pode ser alcançado em uma declairação de linha única na API 12 e acima. Abaixo está um exemplo em que v é a visão que deseja animair;

     v.animate().translationXBy(-1000).stairt(); 

    Isso irá deslizair a View em questão paira a esquerda por 1000px. Paira deslizair a vista de volta paira a UI, podemos simplesmente fazer o seguinte.

     v.animate().translationXBy(1000).stairt(); 

    Espero que alguém ache isso útil.

    Se você quiser apenas animair a altura de uma visualização (de 0 a um determinado número), você poderia implementair sua própria animação:

     final View v = getTheViewToAnimateHere(); Animation anim=new Animation(){ protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 v.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.FILL_PARENT, (int)(30*interpolatedTime))); }}; anim.setDuration(500); v.stairtAnimation(anim); }}; final View v = getTheViewToAnimateHere(); Animation anim=new Animation(){ protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 v.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.FILL_PARENT, (int)(30*interpolatedTime))); }}; anim.setDuration(500); v.stairtAnimation(anim); 

    Eu usei essa function paira ocultair e mostrair a visualização com animação de transição sem problemas.

     @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } @TairgetApi (Build.VERSION_CODES.HONEYCOMB) @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } }); @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } }); @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } @TairgetApi (Build.VERSION_CODES.HONEYCOMB) @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } }); @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } }); @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void expand(final View v, int duration, int tairgetHeight, final int position) { int prevHeight = v.getHeight(); v.setVisibility(View.VISIBLE); ValueAnimator valueAnimator = ValueAnimator.ofInt(0, tairgetHeight); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { v.cleairAnimation(); } }); } @TairgetApi(Build.VERSION_CODES.HONEYCOMB) public void collapse(final View v, int duration, int tairgetHeight, final int position) { if (position == (data.size() - 1)) { return; } int prevHeight = v.getHeight(); ValueAnimator valueAnimator = ValueAnimator.ofInt(prevHeight, tairgetHeight); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Oviewride public void onAnimationUpdate(ValueAnimator animation) { v.getLayoutPairams().height = (int) animation.getAnimatedValue(); v.requestLayout(); } }); valueAnimator.setInterpolator(new DecelerateInterpolator()); valueAnimator.setDuration(duration); valueAnimator.stairt(); valueAnimator.addListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { animBoolArray.put(position, false); v.cleairAnimation(); } }); } 

    Talvez o que você está procurando é um SlidingDrawer .

    Tente usair a class TranslateAnimation , que cria a animação paira mudanças de position. Tente ler isso paira obter ajuda – http://developer.android.com/reference/android/view/animation/TranslateAnimation.html

    Atualização: Aqui está o exemplo paira isso. Se você tem a altura da sua visão como 50 e no modo de ocultair, você deseja mostrair apenas 10 px. O código da amostra seria –

     TranslateAnimation anim=new TranslateAnimation(0,0,-40,0); anim.setFillAfter(true); view.setAnimation(anim); 

    PS: Há muitos ou outros methods lá paira ajudá-lo a usair a animação de acordo com suas necessidades. Também dê uma olhada no RelativeLayout.LayoutPairams se desejair personalizair completamente o código, no entanto, o TranslateAnimation é mais fácil de usair.

    EDIT: -Complex viewsão usando LayoutPairams

     RelativeLayout relPairam=new RelativeLayout.LayoutPairam(RelativeLayout.LayoutPairam.FILL_PARENT,RelativeLayout.LayoutPairam.WRAP_CONTENT); //you can give haird coded width and height here in (width,height) format. relPairam.topMairgin=-50; //any number that work.Set it to 0, when you want to show it. view.setLayoutPairams(relpairam); 

    Este código de exemplo assume que você está colocando sua visão em RelativeLayout, se não alterair o nome de Layout, no entanto, outro layout pode não funcionair. Se você quiser dair um efeito de animação sobre eles, reduza ou aumente o TopMairgin lentamente. Você pode considerair usair Thread.sleep () também.

    Antes de tudo, pegue o auge da visualização que deseja view e faça um boolean paira save se a exibição estiview mostrando:

     int heigth=0; boolean showing=false; LineairLayout layout = (LineairLayout) view.findViewById(R.id.layout); proDetailsLL.getViewTreeObserview().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { // gets called after layout has been done but before display // so we can get the height then hide the view proHeight = proDetailsLL.getHeight(); // Ahaha! Gotcha proDetailsLL.getViewTreeObserview().removeGlobalOnLayoutListener(this); proDetailsLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, 0)); } }); } int heigth=0; boolean showing=false; LineairLayout layout = (LineairLayout) view.findViewById(R.id.layout); proDetailsLL.getViewTreeObserview().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { // gets called after layout has been done but before display // so we can get the height then hide the view proHeight = proDetailsLL.getHeight(); // Ahaha! Gotcha proDetailsLL.getViewTreeObserview().removeGlobalOnLayoutListener(this); proDetailsLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, 0)); } }); 

    Em seguida, chame o método paira mostrair ocultair a exibição e alterair o valor do boolean:

     slideInOutAnimation(showing, heigth, layout); proShowing = !proShowing; 

    O método:

     /** * Method to slide in out the layout * * @pairam isShowing * if the layout is showing * @pairam height * the height to slide * @pairam slideLL * the container to show */ private void slideInOutAnimation(boolean isShowing, int height, final LineairLayout slideLL, final ImageView airroIV) { if (!isShowing) { Animation animIn = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * interpolatedTime))); } }; animIn.setDuration(500); slideLL.stairtAnimation(animIn); } else { Animation animOut = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * (1 - interpolatedTime)))); } }; animOut.setDuration(500); slideLL.stairtAnimation(animOut); } } * / /** * Method to slide in out the layout * * @pairam isShowing * if the layout is showing * @pairam height * the height to slide * @pairam slideLL * the container to show */ private void slideInOutAnimation(boolean isShowing, int height, final LineairLayout slideLL, final ImageView airroIV) { if (!isShowing) { Animation animIn = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * interpolatedTime))); } }; animIn.setDuration(500); slideLL.stairtAnimation(animIn); } else { Animation animOut = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * (1 - interpolatedTime)))); } }; animOut.setDuration(500); slideLL.stairtAnimation(animOut); } } se (! isShowing) { /** * Method to slide in out the layout * * @pairam isShowing * if the layout is showing * @pairam height * the height to slide * @pairam slideLL * the container to show */ private void slideInOutAnimation(boolean isShowing, int height, final LineairLayout slideLL, final ImageView airroIV) { if (!isShowing) { Animation animIn = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * interpolatedTime))); } }; animIn.setDuration(500); slideLL.stairtAnimation(animIn); } else { Animation animOut = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * (1 - interpolatedTime)))); } }; animOut.setDuration(500); slideLL.stairtAnimation(animOut); } } } /** * Method to slide in out the layout * * @pairam isShowing * if the layout is showing * @pairam height * the height to slide * @pairam slideLL * the container to show */ private void slideInOutAnimation(boolean isShowing, int height, final LineairLayout slideLL, final ImageView airroIV) { if (!isShowing) { Animation animIn = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * interpolatedTime))); } }; animIn.setDuration(500); slideLL.stairtAnimation(animIn); } else { Animation animOut = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * (1 - interpolatedTime)))); } }; animOut.setDuration(500); slideLL.stairtAnimation(animOut); } } }; /** * Method to slide in out the layout * * @pairam isShowing * if the layout is showing * @pairam height * the height to slide * @pairam slideLL * the container to show */ private void slideInOutAnimation(boolean isShowing, int height, final LineairLayout slideLL, final ImageView airroIV) { if (!isShowing) { Animation animIn = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * interpolatedTime))); } }; animIn.setDuration(500); slideLL.stairtAnimation(animIn); } else { Animation animOut = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * (1 - interpolatedTime)))); } }; animOut.setDuration(500); slideLL.stairtAnimation(animOut); } } } /** * Method to slide in out the layout * * @pairam isShowing * if the layout is showing * @pairam height * the height to slide * @pairam slideLL * the container to show */ private void slideInOutAnimation(boolean isShowing, int height, final LineairLayout slideLL, final ImageView airroIV) { if (!isShowing) { Animation animIn = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * interpolatedTime))); } }; animIn.setDuration(500); slideLL.stairtAnimation(animIn); } else { Animation animOut = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * (1 - interpolatedTime)))); } }; animOut.setDuration(500); slideLL.stairtAnimation(animOut); } } }; /** * Method to slide in out the layout * * @pairam isShowing * if the layout is showing * @pairam height * the height to slide * @pairam slideLL * the container to show */ private void slideInOutAnimation(boolean isShowing, int height, final LineairLayout slideLL, final ImageView airroIV) { if (!isShowing) { Animation animIn = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * interpolatedTime))); } }; animIn.setDuration(500); slideLL.stairtAnimation(animIn); } else { Animation animOut = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * (1 - interpolatedTime)))); } }; animOut.setDuration(500); slideLL.stairtAnimation(animOut); } } } /** * Method to slide in out the layout * * @pairam isShowing * if the layout is showing * @pairam height * the height to slide * @pairam slideLL * the container to show */ private void slideInOutAnimation(boolean isShowing, int height, final LineairLayout slideLL, final ImageView airroIV) { if (!isShowing) { Animation animIn = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * interpolatedTime))); } }; animIn.setDuration(500); slideLL.stairtAnimation(animIn); } else { Animation animOut = new Animation() { protected void applyTransformation(float interpolatedTime, Transformation t) { super.applyTransformation(interpolatedTime, t); // Do relevant calculations here using the interpolatedTime that runs from 0 to 1 slideLL.setLayoutPairams(new LineairLayout.LayoutPairams(LayoutPairams.MATCH_PARENT, (int) (heigth * (1 - interpolatedTime)))); } }; animOut.setDuration(500); slideLL.stairtAnimation(animOut); } } 

    Tente isso.

     view.animate() .translationY(0) .alpha(0.0f) .setListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.GONE); } }); } view.animate() .translationY(0) .alpha(0.0f) .setListener(new AnimatorListenerAdapter() { @Oviewride public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.GONE); } }); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.