展会信息港展会大全

Android ApiDemos示例解析(132):Views->Layout Animation->7. Nested Animations
来源:互联网   发布日期:2015-10-13 17:07:33   浏览:1456次  

导读:上一篇: http://www.2cto.com/kf/201208/149607.htmlandroid:layoutAnimation 属性定义在ViewGroup中,因此所有ViewGr...

上一篇: http://www.2cto.com/kf/201208/149607.html

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

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

[html]

<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″>

<TableRow

android:layoutAnimation=”@anim/layout_animation_row_right_slide”>

<TextView

android:gravity=”right”

android:text=”@string/layout_animation_name” />

<EditText />

</TableRow>

<TableRow

android:layoutAnimation=”@anim/layout_animation_row_left_slide”>

<TextView

android:gravity=”right”

android:text=”@string/layout_animation_lastname” />

<EditText />

</TableRow>

<TableRow

android:layoutAnimation=”@anim/layout_animation_row_right_slide”>

<TextView

android:gravity=”right”

android:text=”@string/layout_animation_phone” />

<EditText />

</TableRow>

<TableRow

android:layoutAnimation=”@anim/layout_animation_row_left_slide”>

<TextView

android:gravity=”right”

android:text=”@string/layout_animation_address” />

<EditText android:lines=”3″ />

</TableRow>

</TableLayout>

<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″>

<TableRow

android:layoutAnimation=”@anim/layout_animation_row_right_slide”>

<TextView

android:gravity=”right”

android:text=”@string/layout_animation_name” />

<EditText />

</TableRow>

<TableRow

android:layoutAnimation=”@anim/layout_animation_row_left_slide”>

<TextView

android:gravity=”right”

android:text=”@string/layout_animation_lastname” />

<EditText />

</TableRow>

<TableRow

android:layoutAnimation=”@anim/layout_animation_row_right_slide”>

<TextView

android:gravity=”right”

android:text=”@string/layout_animation_phone” />

<EditText />

</TableRow>

<TableRow

android:layoutAnimation=”@anim/layout_animation_row_left_slide”>

<TextView

android:gravity=”right”

android:text=”@string/layout_animation_address” />

<EditText android:lines=”3″ />

</TableRow>

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

赞助本站

人工智能实验室

相关热词: android开发 教程

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港