android:layoutAnimation 属性定义在ViewGroup中,因此所有ViewGroup的子类都可以定义android:layoutAnimation。 ViewGroup可以嵌套定义,从而layout animation 也可以嵌套。

本例使用了TableLayout(ViewGroup的子类),其子View TableRow (也是ViewGroup的子类):

<TableLayout xmlns:android=”http://schemas.android.com/apk/res/android”android:layoutAnimation=”@anim/layout_animation_table”android:animationCache=”false”android:clipToPadding=”false”android:padding=”12dp”android:layout_width=”match_parent”android:layout_height=”match_parent”android:stretchColumns=”1″><TableRowandroid:layoutAnimation=”@anim/layout_animation_row_right_slide”><TextViewandroid:gravity=”right”android:text=”@string/layout_animation_name” /><EditText /></TableRow><TableRowandroid:layoutAnimation=”@anim/layout_animation_row_left_slide”><TextViewandroid:gravity=”right”android:text=”@string/layout_animation_lastname” /><EditText /></TableRow><TableRowandroid:layoutAnimation=”@anim/layout_animation_row_right_slide”><TextViewandroid:gravity=”right”android:text=”@string/layout_animation_phone” /><EditText /></TableRow><TableRowandroid:layoutAnimation=”@anim/layout_animation_row_left_slide”><TextViewandroid:gravity=”right”android:text=”@string/layout_animation_address” /><EditText android:lines=”3″ /></TableRow></TableLayout>

为TableLayout 定义 slide_top_to_bottom, 从上到下滑入屏幕,而TableLayout 的子ViewTableRow,每列向左滑,向右滑动交替。

Android ApiDemos示例解析(132):Views->Layout Animation->7. Nested Animations_第1张图片


更多相关文章

  1. Android 自定义TextView 实现文本间距
  2. Android中自定义switch控件样式
  3. ToggleButton自定义View学习
  4. Android(ViewPager中的ViewPager)ViewPager FragmentPagerAdapter
  5. 自定义控件 - 圆形缓冲进度条
  6. Android studio 自定义view 画圆
  7. Android 的res/values/colors自定义颜色
  8. android 自定义 dialog
  9. Android 自定义BaseRecyclerView.Adapter

随机推荐

  1. 用jasypt加密配置,报错:DecryptionExceptio
  2. 精选篇:Java 开发者2021 值得学习的 14 项
  3. 使用Java 8 Streams处理大量数据
  4. C# BIN文件读取以及CRC校验(匹配STM32F103
  5. webpack打包多html
  6. 说说C#的属性Attribute
  7. 校招字节跳动四小时三面的灵魂拷问,结果我
  8. 第十八章 扩展方法
  9. 用Tomcat启动ServerSocket时 会怎么样
  10. 在 Linux 上使用 groff-me 格式化你的学