Android 组件动画
2016-07-12 15:54
567 查看
Android 组件动画
LayoutAnimationController可以控制一组控件按照规定显示。1、资源文件anim_layout.xml
delay,动画间隔时间,子类动画时间间隔。
animationOrder,动画执行的循序(normal:顺序,random:随机,reverse:反向显示)。
animation,引用动画效果文件。
<?xml version="1.0" encoding="utf-8"?> <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android" android:delay="0.1" android:animationOrder="normal" android:animation="@anim/anim_right_to_left" />
2、资源文件anim_right_to_left.xml
控件从左往右出现。
<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="100%" android:toXDelta="0" android:duration="1000" />
3、布局文件activity_controller_animation.xml
layoutAnimation,引用layoutAnimation资源文件。
<ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent" android:layoutAnimation="@anim/anim_layout" />
4、Activity
在Activity中包含一个列表,列表内容依次从上往下,从右往左出现,每列动画持续1秒,列表之间相差0.1秒。
public class AnimationControllerActivity extends Activity { private String[] month = new String[]{ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_controller_animation); ListView lv = (ListView) findViewById(R.id.listview); lv.setAdapter(new ArrayAdapter<String> (this, android.R.layout.simple_list_item_1, month)); } }
相关文章推荐
- android位置参数left、translationX、x、mScrollX
- Android垂直ProgressBar的实现
- Android之监听手机软键盘弹起与关闭
- Android解决多个Fragment切换时布局重新实例化问题
- Android动画原理分析
- 实现Android页面回到顶部
- 【android学习】socket传输中,流的关闭
- Android学习笔记二十七之ExpandableListView可折叠列表和StackView栈视图
- Android Activity的四种launchmode
- 【Android】根据宽度自动调整(参照图片本身尺寸)高度
- Android自定义view详解
- 圆形图片CircleImageView的使用和分析
- Android MediaPlayer分析
- 40.TabLayout的简单使用
- Android 给控件设置双击事件
- android中intent的作用
- Android 属性动画
- android handler,looper子线程间通信
- (浅谈)Jpush推送通知点击跳转到具体界面
- Android四大基本组件介绍与生命周期