如何动画在android系统的布局? [英] How to animate a layout in android?
本文介绍了如何动画在android系统的布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的活动画面,对屏幕一半包含layout.When活动加载它可见,10秒钟后它会得到慢慢放下最后这将是不可见的user.But它下来slowly.How我可以做it.Please任何一个可以帮助我。
In my Activity screen,half of the screen contain a layout.When Activity loaded it visible and after 10 seconds it will be get down slowly finally it will be not visible to user.But it get down slowly.How i can do it.Please can any one help me.
感谢在前进。
推荐答案
在你的水库\\阿尼姆
文件夹(创建文件夹,如果它不存在)创建 slide_out_down.xml
并粘贴以下
In your res\anim
folder (create the folder if it's not there) create slide_out_down.xml
and paste the following
<?xml version="1.0" encoding="utf-8"?>
<translate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromYDelta="0%p"
android:toYDelta="100%p"
android:duration="@android:integer/config_longAnimTime" />
要启动动画和隐藏视图使用这种
to start the animation and hide the view use this
private void hideView(final View view){
Animation animation = AnimationUtils.loadAnimation(this, R.anim.slide_out_down);
//use this to make it longer: animation.setDuration(1000);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationRepeat(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
view.setVisibility(View.GONE);
}
});
view.startAnimation(animation);
}
这篇关于如何动画在android系统的布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文